sizeof(function) functionality

Kristis Makris kristis.makris@asu.edu
Wed Jul 9 02:35:00 GMT 2003


> > #define sizeof_function(x) ( (unsigned long) (&(endof_##x)) - (unsigned
> > long) (&x))
> > #define endof_function(x) void volatile endof_##x() {}
> > #define DECLARE_END_OF_FUNCTION(x) void endof_##x();
> >
> > Note the volatile keywoard, also used when functions are declared.
> 
> Was there supposed to be a volatile keyword in the DECLARE_END_OF_FUNCTION 
> macro?

Yes! Thank you.

> > It
> > has the effenct of the function and its end  sticking next to each
> > other, or at least out of what I noticed:
> 
> What leads you to this conclusion? Do they not stick next to each other 
> otherwise?

Are they guaranteed to stick together when passing -O4 to gcc?




More information about the Gcc-help mailing list