Tech Tip: Three types of compiler directives
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: November 29, 2021
There are 3 types of compiler directives that can be used to bypass 4D's compiler warning/error checking. Note that each are used for different purposes.
Compiler Directive: //%T-
This directive allows any non-thread safe native 4D command to bypass the 4D compiler thread-safe check shown in the example below:
//%T- DIALOG("myErrorDialog") //%T+ |
Compiler Directive: //%W-
This directive will disable a compiler warning which can be specified by the warning number. For example, if the compiler has the warning:
1: Pointer in an array declaration (518.5)
The warning can be hidden using the syntax below in the 4D method:
//%W-518.5 |
Compiler Directive: //%R-
This directive will disable range checking for array elements or string characters. Note that this directive is only recommended when you are already 100% certain that the code cannot cause errors and need to optimize performance for large number of repeated loops.
// %R- to disable range checking ... //Place the code to be excluded from range checking here // %R+ to enable range checking again for the rest |