On 4/30/10, buginator  wrote:
> 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.
>

A FYI,  after reading
http://msdn.microsoft.com/en-us/library/aa505945.aspx it looks like
BOOL is a int, BOOLEAN is a byte.

We can't do a typedef unsigned char BOOL;  (errors out in the C side
won't allow the redefinition).  We can't do typedef int bool; (errors
out on the C++ side, won't allow the redefinition), so that leaves us
back to using BOOL instead of bool on the C++ side for *ONLY*
functions that are used in C, and that includes all possible
parameters of that function.

Will commit the patch sometime Sunday, unless someone else has a
brainstorm to fix this, and no, dropping MSVC isn't part of the
brainstorming. ;)

_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to