Author | Message | Time |
---|---|---|
Ickypoopy | Here is a mind-numbingly pointless question... If a BOOL must either be a 0 or 1, why is it 32 bits? | January 30, 2003, 12:41 AM |
Arta | afaik, it's 8 bits, not 32. A 32bit bool is a longbool, which can have different values, any of which is considered TRUE if it is nonzero. Come to think of it, i think the same applies to ordinary bools. Not sure :) | January 30, 2003, 7:23 AM |
Skywing | [quote] link=board=general_prog;num=1043901714;start=0#1 date=01/30/03 at 05:23:44]afaik, it's 8 bits, not 32. A 32bit bool is a longbool, which can have different values, any of which is considered TRUE if it is nonzero. Come to think of it, i think the same applies to ordinary bools. Not sure :)[/quote] Apparently Microsoft missed elementary-school math: [code]BOOL GetMessage( LPMSG lpMsg, // message information HWND hWnd, // handle to window UINT wMsgFilterMin, // first message UINT wMsgFilterMax // last message ); If the function retrieves a message other than WM_QUIT, the return value is nonzero. If the function retrieves the WM_QUIT message, the return value is zero. If there is an error, the return value is -1.[/code] The compiler generally converts values assigned to a bool to 0/1 with NOT and SBB (at least in Visual C++)... | January 30, 2003, 9:41 AM |
iago | The reason it isn't one bit is because most (all?) processors can't assign addresses to anything smaller than a byte, just like light can't travel in packets of enery less than whatever that certain little number is.. | January 30, 2003, 11:58 AM |
Eibro | BOOL is a typedef of an int (4 bytes), at least on my system. 32 bit processors can work with 32 bit values faster than they can other sized data... I guess that's part of the reasoning behind the BOOL. You pay for speed with memory... ... Or so i've heard | January 30, 2003, 9:50 PM |