"#define bool bool" says QtCreator when I find bool - I tracked it in boost :: asio

I noticed that it is boolhighlighted in a different color than other types in QtCreator:

image description

This only happens when certain headers are included, in the end I tracked it to <boost/asio.hpp>. The QtCreator code inspector does not seem to be able to track the definition manually. My version I'm using is Boost 1.59.

Is there any purpose for this? I do not mind, but it’s rather strange to define something the same thing, more than that bool.

+4
source share
1 answer

, Boost 1.59, , : #define bool bool #include <stdbool.h>, , , - .


- ? , - , , bool.

, - :

#define bool int
// The next line would change the previous definition
#define bool bool

:

#ifndef bool
#elif bool
#endif
// etc..

C (, ++ ).


, include stdbool.h. (atleast on clang). , ide/highlighter/parser, , /.

, , , :

, GCC -Wall, , .

+4

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


All Articles