Attributes of functions
aland at ox.org
Sun Sep 18 03:35:14 CEST 2005
Nicolas Baradakis <nbk at sitadelle.com> wrote:
> Among other things, Primoz Bratanic has send to me a patch that adds
> attributes to some of the functions. I think it is a good idea, I can
> see only avantages to it:
> - it makes the code more explicit for the reader.
> - it helps the compiler to produce a more performant binary.
> - it makes audit easier.
> Or perhaps this one a little friendlier:
> --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
> #ifdef __GNUC__
> # define NORETURN __attribute__(noreturn)
> # define NORETURN /*NOTHING*/
> 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'd prefer something like:
# define VOID void __attribute__(noreturn)
# define VOID void
static VOID usage(void)
That gets the same effect, and is less awkward to read.
More information about the Freeradius-Devel