[Top][All Lists]

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

Re: [Bug-gnulib] stdbool_.h bug breaks coreutils CVS sort on Alpha GCC 2

From: Paul Eggert
Subject: Re: [Bug-gnulib] stdbool_.h bug breaks coreutils CVS sort on Alpha GCC 2.95.4
Date: 05 Aug 2003 13:12:54 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Bruno Haible <address@hidden> writes:

> I object against this patch because a program is allowed to do
>     #include <stdbool.h>
>     #undef _Bool
>     bool x = true;
> and your patch breaks it.

Pedantically speaking, wouldn't such a program violate the C standard?
The standard says that identifiers like '_Bool' are reserved, and that
programs cannot even #undef them; see the last sentence of section
7.1.3 of the C99 standard.

And practically speaking, such a program is quite unlikely; I don't
think we really need to worry about it.  We cannot emulate C99
<stdbool.h> precisely in C89, for all possible weird test cases.  The
best we can do is support the usage of <stdbool.h> constructs in
practical applications on practical hosts.

> If you really want to care about warnings from this particular non-free
> compiler, I'd prefer a #if conditional, using an autoconf test. Just like
> I had to make this @HAVE__BOOL@ test for the sake of the OSF/1 cc
> compilers.

Perhaps I'm missing something, but I don't see how this proposal would
address your objection.  Even with the #if conditional, a GNU program
still couldn't #undef _Bool, since the code still wouldn't work using
the Forte compiler.

The @HAVE__BOOL@ test doesn't have this problem.

reply via email to

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