The #pragma warning directive allow you to suppress certain compiler warnings for a piece of code.
We support both C# style pragma warnings commands (fully) and Vulcan style pragmas (partially)
#pragma warnings( number, state )
#pragma warnings ( pop )
#pragma warning state2 [<errornumbers>]
#pragma directives must appear between before the first entity or between entities and cannot appear in the middle of an entity
number | Warning number to disable. Can be both numeric or in the form of XSnnnn |
state | Off | Default Disables a warning or switches it back to the situation from the command line |
pop | Switchs all warnings back to their default value |
state2 | Disable | Restore Disables or restores the warning numbers that follow. When no error numbers are specified, then disable disables all warning and restore restores all warning to their default value |
errornumbers | (Optional) comma separated list of numbers or names (XSnnnn) |
The compiler does NOT check if the numbers are valid or if they are indeed warnings. So you can specify non existent numbers and/or numbers that represent errors in stead of warnings. The compiler will not warn you when that is the case.
Example |
Description |
#pragma warning disable 1234 |
Disable warning 1234 |
#pragma warning disable 1234, XS2345 |
Disable 2 warnings 1234 and XS2345 |
#pragma warning restore 1234 |
Reset warning 1234 to the state from the command line |
#pragma warning restore 1234, XS2345 |
Reset 2 warnings 1234 and XS2345 to the state from the command line |
#pragma warning disable |
Disables all warnings |
#pragma warning restore |
Restores all warnings to the settings from the command line |
Example |
Description |
#pragma warnings (1234, off ) |
Disable warning 1234 |
#pragma warnings (1234, default) |
Reset warning 1234 to the state from the command line |
#pragma warnings ( pop ) |
Restores all warnings to the settings from the command line |
NOT supported: |
|
#pragma warnings (1234, on ) |
|
#pragma warnings ( push ) |