Re: bool or BOOL in MFC projects



Vaclav wrote:
Hello,

Should I use bool or BOOL as a return type when I am implementing a new method?

I would make this dependent on whether only you use the return type, or if this return type will be used as parameter of an MFC function. In the first case I'd use bool because this type is the 'natural' Boolean type of C++. In the latter case, using the MFC type BOOL is probably better.

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.

Regards,
Stuart
.


Loading