In Delphi, there are pre-compiled commands similar to C.
I. Instructions:
1. Define command:
Format: {$ define name}
Description: it is used to define a valid symbol (Symbol) in the current unit ). After definition, you can use the if def and ifndef commands to determine whether the symbol exists.
2. UNDEF command:
Format: {$ UNDEF name}
Description: Used to cancel a symbol defined in the current unit ). This command is used with define.
3. ifdef command:
Format: {$ ifdef name}
Note: If the name after the instruction has been defined, compile the instruction until between {$ else} or {$ endif} Code .
4. ifndef command:
Format: {$ ifndef name}
Note: If the name after the instruction is not defined, the code segment between {$ else} or {$ endif} after the instruction is compiled.
5. ifopt command:
Format: {$ ifopt switch}
Note: If the switch after the instruction has been set up, the code segment between {$ else} or {$ endif} after the instruction is compiled.
Example:
{$ Ifopt R +}
Writeln ('Enable range check during compilation ');
{$ Endif}
6. Else command:
Format: {$ else}
Note: Determine whether the code segment between the instruction and {$ endif} should be compiled or ignored by determining the conditional format of the prefix ifxxx.
7. endif command:
Format: {$ endif}
Description: Works with ifxxx to specify the condition pre-compilation section.Source codeThe end position of the CIDR block.
In addition, to define a globally valid name, you must use the menu settings:
Project-options-directories/conditionals, the following conditionals
This is the editing condition. What I want is a valid "Global" definition for {$ ifdef name} {$ else} {$ endif;
Note: It takes effect only after being built...