This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc's <stdbool.h> is broken


On Tue, Feb 06, 2001 at 07:46:29AM +0000, Neil Booth wrote:
> Zack,
> 
> Thanks for the explanation...
> 
> Zack Weinberg wrote:-
> 
> > GCC's <stdbool.h> has been extended so that it works if included
> > from C++ code.  Instead of the above definitions, it does
> > 
> > 	#define _Bool bool
> > 	#define bool bool
> > 	#define true true
> > 	#define false false
> > 	#define __bool_true_false_are_defined 1
> 
> Just curious - what's the point of defining them to themselves?

They are then macros (per C99) but continue to have the effect of the
C++ keywords.

> > However, with these definitions, true and false do not work in #if
> > expressions in C++ even after including stdbool.h.  It is desirable
> > that they do work, for maximum compatibility between C99 and C++, and
> > there's no reason why they shouldn't be known to the C++ preprocessor
> > at all times.
> 
> OK.  Is it known that the C++ people intend them to work in CPP
> expressions in the future?  I'm just a bit wary of yet another
> extension, particularly in this area, since they are quite different
> and ...

I don't know, but hopefully the C++ folks will.

If we decide we don't want this, we should then cause stdbool.h to
#error out when used from C++, otherwise it will break things.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]