Author | Message | Time |
---|---|---|
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? | December 11, 2003, 7:21 PM |
Zakath | bool is a built-in data type. [img]http://www.valhallalegends.com/zakath/BOOL.png[/img] sizeof(bool) == 1 sizeof(BOOL) == 4 That should account for most differences, I'd think. | December 11, 2003, 7:27 PM |
iago | ah, so bool only counts as 1? I figured they had left it as 4 for alignment. Thanks :) | December 11, 2003, 7:51 PM |
Skywing | [quote author=iago link=board=30;threadid=4180;start=0#msg34814 date=1071172286] ah, so bool only counts as 1? I figured they had left it as 4 for alignment. Thanks :) [/quote] 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. | December 12, 2003, 7:30 AM |
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. | December 12, 2003, 11:27 AM |