3.6.3 How Can I Stop Spurious Warnings From Being Produced?

Warnings indicate situations that could possibly lead to code failure. In many situations the code is valid and the warning is superfluous. Always check your code to confirm that it is not a possible source of error and in cases where this is so, there are several ways that warnings can be hidden.

  • The warning level threshold can be adjusted so that only warnings of a certain importance are printed (see 4.5.3.1 Disabling Messages).
  • All warnings with a specified ID can be inhibited.
  • In some situations, a pragma can be used to inhibit a warning with a specified ID for certain lines of source code (see 5.14.3.11 The #pragma Warning Directive).