bluesky idea: __attribute__ (netorder)

Stephen Williams
Sun Sep 6 01:09:00 GMT 1998 said:
> How hard would __attribute(__ (netorder) be to implement? 

Even bluer sky...


The idea here it that any type can be given a named property. Any
application of that type what doesn't have the matching property would
be flagged as a warning. i.e.:

extern inline unsigned long htonl(unsigned long) __attribute__((property(nbo)));

unsigned long foo __attribute__((property(nbo));

foo = 5; // property mismatch warning
foo = htonl(5); // no warning

or how 'bout this one:

	typedef void*image_memory __attribute__((property(image)));
	void dma_from_image_memory(void*dest, image_memory src);
	image_memory fooptr;

	dma_from_image_memory(barptr, fooptr); // OK
	dma_from_image_memory(fooptr, barptr); // warnings


Steve Williams                "The woods are lovely, dark and deep.              But I have promises to keep,            and lines to code before I sleep,       And lines to code before I sleep."

More information about the Gcc mailing list