[Top][All Lists]

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

Re: Bison uses two different 'bool' flavors

From: Paul Eggert
Subject: Re: Bison uses two different 'bool' flavors
Date: Tue, 22 Oct 2002 14:49:12 -0700 (PDT)

> From: Akim Demaille <address@hidden>
> Date: 22 Oct 2002 14:33:53 +0200
> Nevertheless I have a question: is it normal that it fails on my
> machine?

I'm a bit surprised, but not completely surprised.  There are a lot
of broken <stdbool.h>s out there, and perhaps you have one.  Which
version of GCC are you using?  What does your stdbool.h look like?

> +Your @file{system.h} should contain the following code:
> +
> address@hidden
> +# include <stdbool.h>
> +#else
> +typedef enum {false = 0, true = 1} bool;
> +#endif
> address@hidden verbatim

I'm not sure that this is a good recommendation, actually, as the
"#else" part doesn't define symbols that conform to C99.  I realize
that's how coreutils does it but on 2nd thought perhaps gettext has a
better model.  Something like this instead:

# include <stdbool.h>
# if ! HAVE__BOOL
#  ifdef __cplusplus
typedef bool _Bool;
#  else
typedef unsigned char _Bool;
#  endif
# endif
# define bool _Bool
# define false 0
# define true 1
# define __bool_true_false_are_defined 1

I realize that this will require some changes to both Autoconf and its
documentation, though (as well as to Bison, coreutils, etc).  Perhaps
if I get some free time...

reply via email to

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