Nicolas Baradakis <nbk@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.
Sure.
Or perhaps this one a little friendlier:
--- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- #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'd prefer something like: --- #ifdef __GNUC__ # define VOID void __attribute__(noreturn) #else # define VOID void #endif static VOID usage(void) --- That gets the same effect, and is less awkward to read. Alan DeKok.