On 11/10/05 11:21 AM, "David Abrahams"
"Robert Ramey"
writes: [SNIP] But a close substiture might be to convert the variable to an integer, throw an exception if its not equal to 0 or 1
No!! If you convert a bool to an integer and get something other than 0 or 1 then there's a bug in the program (or in the compiler). An assertion is appropriate. [TRUNCATE]
The bug would be in the compiler since other values are not allowed (see s4.5p4 and s4.7p4). I don't think you could really "assert" for this because you can't trust "assert" (since you can't trust the compiler)! If the "bool" was uninitialized before the conversion, then you have undefined behavior and the not-0-nor-1 result is the least of your problems. -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com