MFC refactoring, you use BOOL or bool

Possible duplicate:
When should I use BOOL and bool in C ++?

I am currently tidying up a large C ++ code base, which is mostly MFC and has many BOOL variables and parameters. It also has several bools that, when compared, give a warning about the compiler,

warning C4800: "BOOL": forced bool value "true" or "false" (performance warning)

The plan is a transition to a clean compilation without warning, at warning level 4 in VS2008. My options are as follows:

  • Change all bools to BOOLs Change all
  • BOOLs to bools
  • Do not tell compiler warning 4800

What would you do, and more importantly, why? Currently, I am inclined to the first option, since this code contains a lot of MFC, there are a number of framework functions that return BOOL.

Edit Up, the previously asked question gives me the information I want. Closing ...

+3
source share
1 answer

Changing bool to BOOL globally may not help you. You probably have functions that return bool or accept bool. You will probably change one problem from another. BOOL to bool also cannot be changed because MFC (and Win32 API) use BOOL.

, . BOOL bool , :

BOOL myBOOL; bool mybool;
mybool = (myBOOL != 0);

, (, ), .

, BOOL / bool, ( :)).

+3

Source: https://habr.com/ru/post/1776843/


All Articles