N4713 中的 [cpp.cond]/2
[cpp.cond]/2 in N4713
N4713 中的 [cpp.cond]/2:
A defined-macro-expression evaluates to 1
if the identifier is
currently defined as a macro name (that is, if it is predefined or
if it has been the subject of a #define
preprocessing directive
without an intervening #undef
directive with the same subject
identifier), 0
if it is not.
我不明白上面的或。也就是说,如何在不作为 #define
预处理指令的主题的情况下预定义宏名称?
该实现预定义了一些宏,用户无需 #define
它们。可以在 [cpp.predefined] 中找到标准预定义宏名称的列表。例如,它包括 __FILE__
和 __LINE__
。
因为编译器可以创建宏。他们一直这样做,而这句话是允许他们这样做的一部分。事实上,标准 要求 他们这样做;标准要求实现提供 slew of macros。其中包括 __cplusplus
(C++ 版本)、__FILE__
(正在处理的文件的名称)等等。
[cpp.cond]/2:
A defined-macro-expression evaluates to
1
if the identifier is currently defined as a macro name (that is, if it is predefined or if it has been the subject of a#define
preprocessing directive without an intervening#undef
directive with the same subject identifier),0
if it is not.
我不明白上面的或。也就是说,如何在不作为 #define
预处理指令的主题的情况下预定义宏名称?
该实现预定义了一些宏,用户无需 #define
它们。可以在 [cpp.predefined] 中找到标准预定义宏名称的列表。例如,它包括 __FILE__
和 __LINE__
。
因为编译器可以创建宏。他们一直这样做,而这句话是允许他们这样做的一部分。事实上,标准 要求 他们这样做;标准要求实现提供 slew of macros。其中包括 __cplusplus
(C++ 版本)、__FILE__
(正在处理的文件的名称)等等。