Information Technology Reference
In-Depth Information
The #pragma warning Directive
The #pragma warning directive allows you to turn off warning messages and to turn them
back on.
To turn off warning messages, use the disable form with a comma-separated list of
warning numbers you want to turn off.
￿
To turn warning messages back on, use the restore form with a list of the warning num-
bers you want to turn back on.
￿
For example, the following code turns off two warning messages: 618 and 414. Farther
down in the code, it turns on messages for 618 but leaves the messages for 414 turned off.
Warning messages to turn off
#pragma warning disable 618, 414
... Messages for the listed warnings are off in this section of code.
#pragma warning restore 618
If you use either form without a warning number list, the command then applies to all
warnings.
For example, the following code turns off, and then restores, all warning messages.
#pragma warning disable
... All warning messages are turned off in this section of code.
#pragma warning restore
... All warning messages are turned back on in this section of code.
Search WWH ::




Custom Search