• Welcome to Valhalla Legends Archive.
 

BOOL vs. bool

Started by iago, December 11, 2003, 01:21 PM

Previous topic - Next topic

iago

I noticed that, when I'm using inline assembly, bool functions and BOOL functions don't behave the same.  Can anybody share some light on this?

Thanks!
-iago

[edit] I know that BOOL is typedeffed as an int, but bool seems to be native.  But how are they different?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Zakath

#1
bool is a built-in data type.



sizeof(bool) == 1
sizeof(BOOL) == 4

That should account for most differences, I'd think.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

iago

ah, so bool only counts as 1?  I figured they had left it as 4 for alignment.  

Thanks :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Skywing

Quote from: iago on December 11, 2003, 01:51 PM
ah, so bool only counts as 1?  I figured they had left it as 4 for alignment.  

Thanks :)
It may be padded to 4 bytes depending on how and where it's used.  In the case of function return values, though, typically only al will be set for x86.

Yoni

Also, bool can be either true (1) or false (0), it cannot receive any other values. BOOL can receive any long/doubleword value and this is sometimes sloppily done in Win32 API. Examples: GetMessage return value, and the return value of WM_CTLCOLORSTATIC and its friends.