【发布时间】:2013-09-01 11:12:23
【问题描述】:
在 LLVM 项目的source code of stdbool.h 中,内容如下:
/* 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
在最后 4 行中,有 3 行来自 #define X X。为什么要这么做?它有什么区别?这不会强制编译器将true 替换为true 吗?
【问题讨论】:
标签: c++ c llvm llvm-clang