autoconf
[Top][All Lists]
Advanced

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

#if vs. #ifdef -- again (was: AC_CHECK_SIZEOF failing on undefined HAVE_


From: Ralf Wildenhues
Subject: #if vs. #ifdef -- again (was: AC_CHECK_SIZEOF failing on undefined HAVE_STDINT_H with -Werror)
Date: Tue, 15 Aug 2006 15:45:13 +0200
User-agent: Mutt/1.5.12 (2006-08-10)

Hello Stepan, David,

* Stepan Kasal wrote on Tue, Aug 15, 2006 at 03:00:12PM CEST:
> On Mon, Aug 14, 2006 at 11:42:28PM -0400, David Fang wrote:

> > After all, isn't this the convention used in producing "config.h"
> > and using it for conditional #includes?
> 
> Though I originally thought that `#ifdef' should be used, when I came
> to autoconf community, I heard this ``it is defined as `1', so
> that you can use either `#if' or `#ifdef'.''

Well, it is only defined as 1 if the condition is true, and _not_
defined otherwise.  (Don't you dare change the latter!)  You get the
warning if the condition is not true (but only if you have enabled the
warning to this extent; and it only turns into an error if you also use
-Werror; so to some extent you are already "asking for trouble" -- no
portable nontrivial software will be free of warnings for picky
compilers).

> I cannot recall where i read this, nor I can recall any reason why
> #if would be better.

Neither can I, but there has been a move in some GNU packages (Autoconf,
Gnulib) from #ifdef to #if, which I've never understood.  If we want a
move back, we need to know the incentives that caused it in the first
place, and see whether the reasons for it are (still) valid, to avoid
bouncing back and forth.

This should give a starting point (for those that don't remember crystal
clear ;-) for further research:
http://cygwin.com/ml/autoconf-patches/2000-q1/msg00101.html

> And no, this issue is not regression: Autoconf 2.59 contains `#if HAVE'
> 22 times (not counting the docs), but NO occurence of `#ifdef HAVE'.
> In current CVS, we have still 19 occurences of `#if HAVE' and only
> 7 occurences of `#ifdef HAVE' .

I believe the feedback loop on some of the more obscure issues w.r.t.
Autoconf can easily execed a couple of years.  Not sure if this is one
of them.

A note of caution to David: your picky compiler settings will likely
cause trouble with several other Autoconf macros.

Cheers,
Ralf




reply via email to

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