MFC and its BOOL type...
-
I have a peculiar question to ask you gurus... Being the person I am who pays attention to minor details, I was wondering if you could explain me in as much detail as you can why is it that MFC and some Win32 interface methods instead of using the standard C++
bool
data-type, useBOOL
(which maps to the plain oldint
) ? Any insights you could provide would be much apreciated. Thank you so much, David Nimrod -
I have a peculiar question to ask you gurus... Being the person I am who pays attention to minor details, I was wondering if you could explain me in as much detail as you can why is it that MFC and some Win32 interface methods instead of using the standard C++
bool
data-type, useBOOL
(which maps to the plain oldint
) ? Any insights you could provide would be much apreciated. Thank you so much, David NimrodBOOL
is a type defined by the Windows headers. Since MFC and Win32 were around beforebool
existed in C++, they useBOOL
. (Actually Win32 usesBOOL
to maintain C compatibility.) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer." -- Michael P. Butler in the Lounge -
BOOL
is a type defined by the Windows headers. Since MFC and Win32 were around beforebool
existed in C++, they useBOOL
. (Actually Win32 usesBOOL
to maintain C compatibility.) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer." -- Michael P. Butler in the Lounge -
BOOL
is a type defined by the Windows headers. Since MFC and Win32 were around beforebool
existed in C++, they useBOOL
. (Actually Win32 usesBOOL
to maintain C compatibility.) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer." -- Michael P. Butler in the Lounge -
Yeah I was told about that before. Only thing I wonder, though, is that why they used an
int
not anBYTE
, to represent such a type that merely needs to maintain "yes or no", but then I guess we've all used to that already.It probably stems back to the days when we had 8-bit integers. Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain) -
Yeah I was told about that before. Only thing I wonder, though, is that why they used an
int
not anBYTE
, to represent such a type that merely needs to maintain "yes or no", but then I guess we've all used to that already. -
Yeah I was told about that before. Only thing I wonder, though, is that why they used an
int
not anBYTE
, to represent such a type that merely needs to maintain "yes or no", but then I guess we've all used to that already.Depending on your CPU, access to anything of less than an int may be very slow. Alpha for instance (which windows NT ran on) didn't give you easy access to a single byte, it could be done, but the code was fairly high.