Share via


Enabling STRICT Type Checking

OverviewHow Do I

To enable STRICT type checking, define the symbol name "STRICT." Open the Project Settings dialog box, select the C/C++ tab, select General in the Categories box, and type STRICT in the Preprocessor Definitions box. You can also specify this definition on the command line or in a makefile by giving /DSTRICT as a compiler option.

To define STRICT on a file-by-file basis (supported by C but not C++, as explained in the note that follows), insert a #define statement before including WINDOWS.H in files where you want to enable STRICT:

#define STRICT
#include WINDOWS.H

For best results, you should also set the warning level for error messages to at least /W3. This is always advisable with applications for Windows, because a coding practice that causes a warning (for example, passing the wrong number of parameters) usually causes a fatal error at run time if it is not corrected.

Note   If you are writing a C++ application, you don’t have the option of applying STRICT to only some of your source files. Because of the way C++ “type safe linking” works, mixing STRICT and non-STRICT source files in your application can cause linking errors.