Skip to content

Remove duplicate conditional-compilation example #631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions standard/lexical-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -1255,29 +1255,6 @@ fragment PP_Endif

Conditional compilation directives shall be written in groups consisting of, in order, a `#if` directive, zero or more `#elif` directives, zero or one `#else` directive, and a `#endif` directive. Between the directives are ***conditional sections*** of source code. Each section is controlled by the immediately preceding directive. A conditional section may itself contain nested conditional compilation directives provided these directives form complete groups.

> *Example*: The following example illustrates how conditional compilation directives can nest:
>
> ```csharp
> #define Debug // Debugging on
> #undef Trace // Tracing off
> class PurchaseTransaction
> {
> void Commit()
> {
> #if Debug
> CheckConsistency();
> #if Trace
> WriteToLog(this.ToString());
> #endif
> #endif
> CommitHelper();
> }
> ...
> }
> ```
>
> *end example*

At most one of the contained conditional sections is selected for normal lexical processing:

- The *PP_Expression*s of the `#if` and `#elif` directives are evaluated in order until one yields `true`. If an expression yields `true`, the conditional section following the corresponding directive is selected.
Expand Down