Option Type | Default Value | #pragma options | C | C++ |
-qoption | nocheck | CHECK | x | x |
Syntax
-qcheck | -qcheck=suboptions | -qnocheck CHECK | CHECK=suboptions | NOCHECK
Purpose
Generates code that performs certain types of runtime checking. If a violation is
encountered, a runtime exception is raised by sending a SIGTRAP signal to
the process.
Notes
The -qcheck option has the following suboptions. If you use more
than one suboption, separate each one with a colon (:).
all | Switches on all the following suboptions. You can use the all
option along with the no... form of one or more of the other options as a
filter. For example, using: xlC myprogram.c -qcheck=all:nonull provides checking for everything except for addresses contained in pointer variables used to reference storage. If you use all with the no... form of the options, all should be the first suboption. |
NULLptr | NONULLptr | Performs runtime checking of addresses contained in pointer variables used to reference storage. The address is checked at the point of use; a trap will occur if the value is less than 512. |
bounds | nobounds | Performs runtime checking of addresses when subscripting within an object of known size. The index is checked to ensure that it will result in an address that lies within the bounds of the object's storage. A trap will occur if the address does not lie within the bounds of the object. |
DIVzero | NODIVzero | Performs runtime checking of integer division. A trap will occur if an attempt is made to divide by zero. |
Using the -qcheck option without any suboptions turns all the suboptions on.
Using the -qcheck option with suboptions turns the specified suboptions on if they do not have the no prefix, and off if they have the no prefix.
You can specify the -qcheck option more than once. The suboption settings are accumulated, but the later suboptions override the earlier ones.
The #pragma options directive must be specified before the first statement in the compilation unit.
The -qcheck option affects the runtime performance of the application. When checking is enabled, runtime checks are inserted into the application, which may result in slower execution.
Example
For -qcheck=null:bounds:
void func1(int* p) { *p = 42; /* Traps if p is a null pointer */ } void func2(int i) { int array[10]; array[i] = 42; /* Traps if i is outside range 0 - 9 */ }For -qcheck=divzero:
void func3(int a, int b) { a / b; /* Traps if b=0 */ }
List of Batch Compiler Options and Their Defaults
Options that Specify Debugging Features
Equivalent Batch Compile-Link and Incremental
Build Options