#ifndef Statement

Delimit statements to be conditionally included in the build if a pre-processor symbol is not defined.

Syntax

#ifndef [ symbol ]

[ statements1 ]

[ #else

[ statements2 ] ]

#endif

Comments

The #ifndef statement is compatible  with ATEasy 2023/v12 or newer.

The statements allows the user to conditional build an application so that only the code relevant to the desired options is parsed. This can significantly reduce the size of the application as run and avoids problems such as unwanted code which uses a driver which will not available in the intended run environment.

If symbol is defined, the first block of statements will be parsed. If not, the first block of statements is skipped and the second block of statements is parsed. Either block of statements may be empty. If the second block of statements is empty, the #else statement can be omitted.

ATEasy is provided with pre-define pre-defined preprocessor symbols. To define a user defined symbol, enter the symbol name in the Project Misc property page. If multiple symbols are required, separate them by commas.  

Example

The following example compiles the first block if the code is compiled with 64-bit of ATEasy, otherwise the second block is compiled:

#ifndef AX64

! 64-bit code, first block of code

#else

! 32-bit code, second block of code

#endif

 

See Also

#ifdef Statement, If statement, Preprocessor Symbols