9.5.1 Conditional compilation symbols

博客介绍了C#中由#if、#elif、#else和#endif指令提供的条件编译功能,其通过预处理表达式和条件编译符号控制。条件编译符号有定义和未定义两种状态,在源文件词法处理开始时,除非外部机制定义,否则为未定义。#define和#undef指令仅影响当前源文件。
9.5.1 Conditional compilation symbols
The conditional compilation functionality provided by the #if, #elif, #else,
and #endif directives is
controlled through pre-processing expressions (§9.5.2) and conditional
compilation symbols.
conditional-symbol::
Any identifier-or-keyword except true or false
A conditional compilation symbol has two possible states: defined or
undefined. At the beginning of the lexical
processing of a source file, a conditional compilation symbol is undefined
unless it has been explicitly defined by
an external mechanism (such as a command-line compiler option). When a
#define directive is processed, the
conditional compilation symbol named in that directive becomes defined in
that source file. The symbol remains
defined until an #undef directive for that same symbol is processed, or
until the end of the source file is reached.
An implication of this is that #define and #undef directives in one source
file have no effect on other source
files in the same program.
The name space for conditional compilation symbols is distinct and separate
from all other named entities in a
C# program. Conditional compilation symbols can only be referenced in
#define and #undef directives and in
pre-processing expressions.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值