|
|
|
|
|
by revelation
4674 days ago
|
|
bool a = value & (1 << 5)
a will be 1 or 0, not 1 << 5. You don't get this behavior with a normal int.
MSVC also has a warning about some of this behavior [1], with a nonsense performance subtext. I don't think theres a GCC equivalent.1: http://msdn.microsoft.com/en-us/library/b6801kcy.aspx |
|
In any sane language you can't redefine bool that way, nobody would ever expect bool to take more than two values, and there wouldn't be a problem.