13.07.2015 Views

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9 Lexical structure#define A#define AFor compilers that allow conditional compilation symbols to be defined as compilation options, an alternativeway for such redefinition to occur is to define the symbol as a compiler option as well as in the source. endexample]A #undef may “undefine” a conditional compilation symbol that is not defined. [Example: The example belowdefines a conditional compilation symbol A and then undefines it twice; although the second #undef has noeffect, it is still valid.#define A#undef A#undef Aend example]9.5.4 Conditional compilation directivesThe conditional compilation directives are used to conditionally include or exclude portions of a source file.pp-conditional::pp-if-section pp-elif-sections opt pp-else-section opt pp-endifpp-if-section::whitespace opt # whitespace opt if whitespace pp-expression pp-new-line conditional-section optpp-elif-sections::pp-elif-sectionpp-elif-sections pp-elif-sectionpp-elif-section::whitespace opt # whitespace opt elif whitespace pp-expression pp-new-line conditional-section optpp-else-section::whitespace opt # whitespace opt else pp-new-line conditional-section optpp-endif::whitespace opt # whitespace opt endif pp-new-lineconditional-section::input-sectionskipped-sectionskipped-section::skipped-section-partskipped-section skipped-section-partskipped-section-part::skipped-characters opt new-linepp-directiveskipped-characters::whitespace opt not-number-sign input-characters optnot-number-sign::Any input-character except #[Note: As indicated by the syntax, conditional compilation directives must be written as sets consisting of, inorder, an #if directive, zero or more #elif directives, zero or one #else directive, and an #endif directive.Between the directives are conditional sections of source code. Each section is controlled by the immediatelypreceding directive. A conditional section may itself contain nested conditional compilation directives providedthese directives form complete sets. end note]A pp-conditional selects at most one of the contained conditional-sections for normal lexical processing:65

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!