bug-gnulib
[Top][All Lists]
Advanced

[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: Eric Blake
Subject: Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)
Date: Thu, 18 Mar 2010 08:09:15 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3

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:

if (CONDITION)
  do_something ();

than

#if CONDITION
  do_something ();
#endif

but that only works if CONDITION is always defined to 0 or 1.  In
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.  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:

#ifndef CONDITION
# define CONDITION
#endif

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

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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