[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)

From: Grégoire Sutre
Subject: Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)
Date: Thu, 18 Mar 2010 16:45:46 +0100
User-agent: Thunderbird (X11/20091027)

Eric Blake wrote:
On 03/17/2010 06:58 PM, Grégoire Sutre wrote:
Just out of curiosity: is there a reason for this behavior of
AC_CHECK_DECLS, which, quoting the manual, is unlike the other
‘AC_CHECK_*S’ macros?

Yes - it looks cleaner to write code like:

  do_something ();


  do_something ();

but that only works if CONDITION is always defined to 0 or 1.

I see.  And the compiled file should be the same if the compiler
performs (even simple) dead-code elimination.

general, we prefer to avoid #if inside function bodies; it is easier to
read code where all the #if have been factored out to file scope level
and function bodies are straight-line code.

I agree that functions can be difficult to read when they contain #if
conditions.  However, these cannot be avoided when the types of the
function's local variables depend on them.

Newer autoconf macros
follow this style, and gnulib continues it for most macros defined by
gnulib.  And even for the older autoconf macros which did not follow
this paradigm, it's not too hard to do:

# define CONDITION

at the top of the file, to once again keep #if out of function bodies.

Good to know, thanks!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]