-
BOOL vs. bool?
Until recently I've been using BOOL for most of my TRUE | FALSE stuff, awhile back someone told me I'm better off using bool, as BOOL in the SDK creates much larger values than I need for just TRUE and FALSE. Any Pros and Cons in using one or the other? Or for that matter any truth in the claim?
-
BOOL is a typdef of an int and is, as such, 32 bits at the moment. It is declared in windows.h.
>>> Any Pros and Cons in using one or the other?
Yes, if you use one type when the other is expected you can get errors. Sometimes extremely difficult to find errors.
I tend to use bool for my own stuff, because it is portable without using typdef's, however, when I'm using API functions, (portability is then not an issue of course), I always use the type expected.
-
Well, BOOL TRUE is acually an integer 1. FALSE being 0.
bool true is just that, true (similar for false) Problems can arise mixing BOOLs and bools together as information can be lost/take a performance hit in the conversion. Usually MSVC compiler picks these problems up as warnings if the warning level is set to 3 or better.
-
Sorry adrianxw, must have posted at the same time.