On 4/30/10, Christian Ohm wrote: > On Thursday, 29 April 2010 at 22:45, buginator wrote: > > After some more tinkering with the code, I finally found the issue > > that MSVC was having. In short, a bool in c is a int, and in c++ a > > bool !=int. It was always returning 256 on false, and -858993663 on > > true. For those that don't see what that is, here: > > false = 0x00000100, true = 0xcccccc01 make sense ? > > > No. Is this another Microsoft stupidity? Evalutating true to 1 and false to 0 > seems to be required by the C++ standard
We are not using C++, we are using mixed C & C++, and in the pre C-99 standard there is no bool type. It is a typedef to a int for MSVC. In C++, the bool type is 1 byte, not a int, in MSVC. In order to use cross-platform friendly types, then we must not use the C++ bool type, and instead use a typedef that will work fine in pre C-99 code, hence it should be a int, which is why my patch uses BOOL, since we already use that in the codebase, and that is a int on all platforms. 'bool' (in the C code) is typedef to a int as well. _______________________________________________ Warzone-dev mailing list [email protected] https://mail.gna.org/listinfo/warzone-dev
