[issue2497] stdbool support

Rolland Dudemaine report at bugs.python.org
Fri Mar 28 00:55:24 CET 2008


Rolland Dudemaine <rolland at ghs.com> added the comment:

Some compilers define false and true as macros.
When doing this, the definition in asdl.h (included from asdl.c) which 
is originally :
typedef enum {false, true} bool;
therefore becomes :
typedef enum {0, 1} bool;
which is non-sensical.
Using stdbool.h when it is available will ensure bool is defined as a 
type following the correct definition, which may or may not be an enum 
depending on the compiler.
Even when using gcc, stdbool.h is here to define bool in C language, so 
why not use it ?

--Rolland

Martin v. Löwis wrote:
> Martin v. Löwis <martin at v.loewis.de> added the comment:
>
> Why does it improve portability to use stdbool.h when it exists?
>
> What is the potential issue with asdl.c that gets fixed with this patch?
>
> ----------
> nosy: +loewis
>
> __________________________________
> Tracker <report at bugs.python.org>
> <http://bugs.python.org/issue2497>
> __________________________________
>

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2497>
__________________________________


More information about the Python-bugs-list mailing list