Pragmas, OverviewΒΆ

The pragma instruction is used to affect the properties of a variable concerning the compilation resp. precompilation process. It can be used in with supplementary text in a program line of the or in its own line.

The pragma instruction is enclosed in curly brackets, upper- and lower-case are ignored: { <Instruction text> }

If the compiler cannot meaningfully interpret the instruction text, the entire pragma is handled as a comment and read over. A warning will be issued in this case.

Depending on the type and contents of pragma, the pragma either operates on the line in which it is located or on all subsequent lines until it is ended by an appropriate pragma, or the same pragma is executed with different parameters, or the end of the file is reached. By file we mean here: declaration part, implementation portion, global variable list, type declaration.

The opening bracket may immediately follow a variable name. Opening and closing brackets must be located on the same line.

The following pragmas are currently available in CoDeSys: