Attributes of functions
nbk at sitadelle.com
Sun Sep 18 16:17:05 CEST 2005
Alan DeKok wrote:
> > Or perhaps this one a little friendlier:
> > #ifdef __GNUC__
> > # define NORETURN __attribute__(noreturn)
> > #else
> > # define NORETURN /*NOTHING*/
> > #endif
> > static void NORETURN usage(void)
> Putting #ifdef's in header files is OK. I'm a little more wary
> about putting them in the source.
I was planing to add the #defines in a header file of course.
These are portability issues, so I think they should go in autoconf.h
or in missing.h.
> I'd prefer something like:
> #ifdef __GNUC__
> # define VOID void __attribute__(noreturn)
> # define VOID void
> static VOID usage(void)
> That gets the same effect, and is less awkward to read.
I think this syntax is a little confusing. The reader may mistakenly
think that the function returns with no value, whereas the attribute
of the function means the function never returns.
I'd like better "static NORETURN usage(void)" in this case.
More information about the Freeradius-Devel