The /Zr option checks for null or out-of-range pointers in your program. A run-time error occurs if you try to run a program with such pointers. The /Zr option is only available with the fast compile (/f) option.
If you compile with the /Zr option, you can use the check_pointer pragma within your source file to turn checking on or off only for selected pointers, leaving the default (see below) for the remaining pointers in the program. When you want to turn on pointer checking, put the following line before the usage of the pointer you want to check:
#pragma check_pointer (on)
This line turns on pointer checking for all pointers that follow it in the source file, not just the pointers on the following line. To turn off pointer checking, insert the following line at the location you want pointer checking turned off:
#pragma check_pointer (off)
If you don't give an argument for the check_pointer pragma, pointer checking reverts to the behavior specified on the command line: turned on if the /Zr option is given or turned off otherwise.
Example
CL /Zr PROG.C
This command causes CL to check for null or out-of-range pointers in the file PROG.C. All pointers in the file are checked except those to which a check_pointer(off) pragma applies.