Determining Which Settings Are Saved and Restored

Not all pragma settings are saved and restored by pragmas push and pop . Pragmas that do not change compiler settings are not affected by push and pop . For example, pragma message cannot be saved and restored.

Testing if pragmas push and pop save and restore a setting shows an example that checks if the ANSI_strict pragma setting is saved and restored by pragmas push and pop .

Listing 1. Testing if pragmas push and pop save and restore a setting
/* Preprocess this source code. */
#pragma ANSI_strict on
#pragma push
#pragma ANSI_strict off
#pragma pop
#if __option(ANSI_strict)
#error "Saved and restored by push and pop."
#else
#error "Not affected by push and pop."
#endif
Related information
Checking Pragma Settings
Saving and Restoring Pragma Settings
Invalid Pragmas
Pragma Scope