In the source code of stdbool.h
in LLVM project, it reads:
/* Don't define bool, true, and false in C++, except as a GNU extension. */
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Define _Bool, bool, false, true as a GNU extension. */
#define _Bool bool
#define bool bool
#define false false
#define true true
#endif
In the last 4 lines there are three lines of the from #define X X
. Why would you do that? What difference does it make? Wouldn't this force compiler to just replace, say, true
with true
?