Checking Pragma Settings

The preprocessor function __option() returns the state of pragma settings at compile-time. The syntax is

  __option(setting-name)   

where setting-name is the name of a pragma that accepts the on, off, and reset arguments.

If setting-name is on, __option(setting-name) returns 1. If setting-name is off, __option(setting-name) returns 0. If setting-name is not the name of a pragma, __option(setting-name) returns false. If setting-name is the name of a pragma that does not accept the on, off, and reset arguments, the compiler issues a warning message.

The following listing shows an example.

Listing: Using the __option() preprocessor function
#if __option(ANSI_strict)
#include "portable.h" /* Use the portable declarations. */

#else

#include "custom.h" /* Use the specialized declarations. */

#endif