[Python-Dev] Boolean transition (original) (raw)
Tim Peters tim.one@comcast.net
Sun, 10 Mar 2002 22:56:02 -0500
- Previous message: [Python-Dev] Boolean transition
- Next message: [Python-Dev] Boolean transition
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[David Abrahams]
Actually, I'm a C++ guy: && and || return false or true. I think 'C99' also got some kind of Bool type, but I don't know how it acts.
#define bool _Bool #define false 0 #define true 1 #define __bool_true_false_are_defined 1
are in <stdbool.h>. _Bool is an unsigned integral type, subject to the usual promotions. Just about the only twist beyond that is that conversion of a scalar s to _Bool yields 1 if and only if s != 0. So, e.g.,
bool b = 0.16; /* sets b to 1 */
&& and || haven't changed (return int 0 or int 1).
- Previous message: [Python-Dev] Boolean transition
- Next message: [Python-Dev] Boolean transition
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]