while true: !!!
Rainer Deyke
root at rainerdeyke.com
Wed Dec 20 13:08:05 EST 2000
"Greg Jorgensen" <gregj at pobox.com> wrote in message
news:%8Y%5.172260$U46.5443571 at news1.sttls1.wa.home.com...
> It was an old compiler. I haven't used C++ in over a year, but I believe
> that the addition of bool caused some problems: sizeof(bool) is not
> standardized, and bool is defined as 0 is false, anything else is true,
> which means a bool expression may not be equal to "true." Please forgive
me
> if my understanding of this isn't correct: the last C++ compiler I used
> didn't have bool support built-in.
In modern C++, a 'bool' can have exactly two values: 'true' and 'false'.
When promoted to an integer type, 'true' translates to '1' and 'false'
translates to '0'. When converting from an integer type to 'bool', '0'
becomes 'false' and everything else becomes 'true'. In other words,
'int(bool(5))' evaluates to '1'. The comparison operators (==, !=, <, etc.)
all yield a value of type 'bool'.
--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list
mailing list