bool and integer
Quote:Original post by Antheus
True.
bool value of false is equivalent to 0, any other value is equivalent to true;
I thoguht -1 was false? :(
Crazyfool, some languages (QBasic, probably others) define false as 0, and true as -1, since in binary 0 is all 0's and -1 is all 1's (and hence true is a binary not of false).
C and C++ however treat any value except 0 as true.
C and C++ however treat any value except 0 as true.
Quote:Original post by sphen_lee
Crazyfool, some languages (QBasic, probably others) define false as 0, and true as -1, since in binary 0 is all 0's and -1 is all 1's
Sure, if your processor does calculations in twos complement.
[Edited by - jflanglois on April 5, 2007 11:42:47 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement