a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
7 lines
1.7 KiB
XML
7 lines
1.7 KiB
XML
<?xml version="1.0"?>
|
|
<clause number="9.5.1" title="Conditional compilation symbols">
|
|
<paragraph>The conditional compilation functionality provided by the <symbol>#if</symbol>, <symbol>#elif</symbol>, <symbol>#else</symbol>, and <symbol>#endif</symbol> directives is controlled through pre-processing expressions (<hyperlink>9.5.2</hyperlink>) and conditional compilation symbols. <grammar_production><name><non_terminal where="9.5.1">conditional-symbol</non_terminal></name> :: <rhs>Any <non_terminal where="9.4.2">identifier-or-keyword</non_terminal> except <keyword>true</keyword> or <keyword>false</keyword> </rhs></grammar_production></paragraph>
|
|
<paragraph>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 <symbol>#define</symbol> directive is processed, the conditional compilation symbol named in that directive becomes defined in that source file. The symbol remains defined until an <symbol>#undef</symbol> directive for that same symbol is processed, or until the end of the source file is reached. An implication of this is that <symbol>#define</symbol> and <symbol>#undef</symbol> directives in one source file have no effect on other source files in the same program. </paragraph>
|
|
<paragraph>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 <symbol>#define</symbol> and <symbol>#undef</symbol> directives and in pre-processing expressions. </paragraph>
|
|
</clause>
|