Navigation: Advanced Topics > Legacy Project System Reference >====== Check #pragmas ====== | ![]() ![]() ![]() |
#pragmas with the class name check control run-time error checking. These can help you to locate erroneous program logic, but at the expense of slower execution. All these #pragmas default to off.
When a run-time check detects an error, the default action is to terminate the process and create the file CWLOG.TXT.
The following check #pragmas are available:
#pragma check(guard ⇒ on | off)
#pragma check(index ⇒ on | off)
#pragma check(nil_ptr ⇒ on | off)
#pragma check(overflow ⇒ on | off)
#pragma check(range ⇒ on | off)
#pragma check(stack ⇒ on | off)
A pragma can be used in the Project language, C++ code, Modula-2 code, or Clarion code. Some only work in certain places. A 'P' to the right of the pragma indicates it can be used in the Project language, a 'C' indicates it can be used in C++ code, a 'M' indicates it can be used in Modula-2 code, and a 'W' indicates that it can be used in Clarion code (CLW files).
#pragma check(stack ⇒ on | off) cpmw
When on, the run-time system checks that your program does not run out of stack space. You can increase the size of the stack using the data(stack_size) #pragma.
#pragma check(nil_ptr ⇒ on | off) cpmw
When on, the run-time system checks for any dereference of NULL or NIL pointers.
#pragma check(range ⇒ on | off) pm
When on, a range check is performed whenever a value is assigned to a variable of subrange or enumerated type. In addition, compile-time values are checked to ensure that they are in the range of their type.
#pragma check(overflow ⇒ on | off) pm
When on, the run-time system checks that numeric values do not go out of range.
#pragma check(index ⇒ on | off) cpmw
When on, the run-time system checks for the use of an array index larger than the array size.
#pragma check(guard ⇒ on | off) pm
This #pragma controls whether checks are performed on the checked-guard operator.