Re: bool or BOOL in MFC projects
- From: "David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Dec 2007 13:28:48 GMT
"Stuart Redmann" <DerTopper@xxxxxx> wrote in message
news:fk884c$bl$1@xxxxxxxxxxxxxxx
It's a pitty that MFC didn't change the Win32 type BOOL to the C++ type
bool (after all, MFC is a C++ API). The overhead of the conversion between
BOOL and bool can be neglected by any application that deals with a
graphical user interface provided by GDI.
The thing is, with MFC you are never far away from the raw intricacies of
Windows. I think as long as the raw Windows API's use BOOL, it makes sense
for MFC to use BOOL also because MFC interacts with the raw API's so much.
If you're not careful, the differences of bool and BOOL can bite you,
especially with things like COM access.
My practice is to use BOOL throughout an MFC app. Old fashioned, perhaps.
But entirely consistent, and I never have to ask whether to use bool or BOOL
or be annoyed by the pesky warning about C++ performance when using a BOOL
when bool was expected or vice-versa. Since, as you say, the actual
performance gain of a bool in GUI apps is negligible. To me, why use 2
things when 1 suffices?
-- David
.
- Follow-Ups:
- Re: bool or BOOL in MFC projects
- From: Ian Semmel
- Re: bool or BOOL in MFC projects
- From: Joseph M . Newcomer
- Re: bool or BOOL in MFC projects
- References:
- bool or BOOL in MFC projects
- From: Vaclav
- Re: bool or BOOL in MFC projects
- From: Stuart Redmann
- bool or BOOL in MFC projects
- Prev by Date: Re: Window Messages Not Getting Processed in Vista With UAC ON in Win32
- Next by Date: Re: CListctrl::GetItemData causing problem
- Previous by thread: Re: bool or BOOL in MFC projects
- Next by thread: Re: bool or BOOL in MFC projects
- Index(es):
Relevant Pages
|