D language compiler instruction (PRAGMA)

xiaoxiao2021-03-06  22

Compiler instruction

Pragma:

PRAGMA (marker)

Pragma (List, Expression List)

Pragma:

Pragma (Identifier)

Pragma (Identifier, ExpressionList)

The compiler instruction is used to pass the compiler how to use the product provider's special extension of D. The instructions are ending with ';', they can affect a statement, a statement, a statement or a statement.

Pragma (Ident); // Separate

Pragma (Ident) Declaration; // Effect

Pragma (Ident): / / A subsequent statement

Declaration;

Declaration;

Pragma (Ident) / / affects a statement

{Declaration;

Declaration;

}

Pragma (Ident) statement; // affects a statement

PRAGMA (Ident) / / affects a statement

{Statement;

STATEMENT;

}

Type of instructions

The flag is indicated.

Expression list is separated by commas

Assigning a list of expression.

Assignment expressions must be parsed as expressions, but their semantics depends on the semantics of the specific compiler instruction.

All implementations of predefined PRAGMA must support these instructions, otherwise it is ignored:

MSG

Print the message when compiling,

Assignment expressions must be string quantity:

PRAGMA (MSG, "Compiling ...");

Product provider's PRAGMA specific to product providers directive

The flag should start with the trademark name of the product provider, the same version of the same version of the marker is similar:

Pragma (DIGITALMARS_FUNKY_EXTENSION) {...}

Even if a compiler instruction is known, the compiler must also generate "unrecognizable"

Pragma "Error. This means that the product provider's compiler directive must be packaged in the Version statement:

Version (DigitalMars)

{

Pragma (DIGITALMARS_FUNKY_EXTENSION) {...}

}

转载请注明原文地址:https://www.9cbs.com/read-59297.html

New Post(0)