Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 9 Lexical structureprevious at this levelnext at this level 9.5 Pre-processing directives Paragraph 11 The pre-processing directives provide the ability to conditionally skip sections of source files, to report error and warning conditions, and to delineate distinct regions of source code. [Note: The term "pre-processing directives" is used only for consistency with the C and C++ programming languages. In C#, there is no separate pre-processing step; pre-processing directives are processed as part of the lexical analysis phase. end note] pp-directive :: pp-declaration pp-conditional pp-line pp-diagnostic pp-region Paragraph 21 The following pre-processing directives are available: Paragraph 31 A pre-processing directive always occupies a separate line of source code and always begins with a # character and a pre-processing directive name. 2 White space may occur before the # character and between the # character and the directive name. Paragraph 41 A source line containing a #define, #undef, #if, #elif, #else, #endif, or #line directive may end with a single-line comment. 2 Delimited comments (the /* */ style of comments) are not permitted on source lines containing pre-processing directives. Paragraph 51 Pre-processing directives are not tokens and are not part of the syntactic grammar of C#. 2 However, pre-processing directives can be used to include or exclude sequences of tokens and can in that way affect the meaning of a C# program. [Example: For example, when compiled, the program
#define A  
#undef B  
class C  
{  
   #if A  
   void F() {}  
   #else  
   void G() {}  
   #endif  
   #if B  
   void H() {}  
   #else  
   void I() {}  
   #endif  
}  
results in the exact same sequence of tokens as the program
class C  
{  
   void F() {}  
   void I() {}  
}  
Thus, whereas lexically, the two programs are quite different, syntactically, they are identical. end example]
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS