Remarks, Warnings, and Errors

This topic describes compiler remarks, warnings, and errors. The Intel® C++ Compiler displays these messages, along with the erroneous source line, on the standard output.

Remarks

Remark messages report common but sometimes unconventional use of C or C++. The compiler does not print or display remarks unless you specify the -w2 option. Remarks do not stop translation or linking. Remarks do not interfere with any output files. The following are some representative remark messages:

Warnings

Warning messages report legal but questionable use of the C or C++. The compiler displays warnings by default. You can suppress all warning messages with the -w compiler option. Warnings do not stop translation or linking. Warnings do not interfere with any output files. The following are some representative warning messages:

Additional Warnings

This version of Intel C++ Compiler includes support for the following options:

Option Result
-W[no-]missing-prototypes Warn for missing prototypes
-W[no-]pointer-arith Warn for questionable pointer arithmetic
-W[no-]uninitialized Warn if a variable is used before being initialized
-W[no-]deprecated Display warnings related to deprecated features
-W[no-]abi Warn if generated code is not C++ ABI compliant
-W[no-]unused-function Warn if declared function is not used
-W[no-]unknown-pragmas Warn if an unknown #pragma directive is used
-W[no-]main Warn if return type of main is not expected
-W[no-]comment[s] Warn when /* appears in the middle of a /* */ comment
-W[no-]return-type Warn when a function uses the default int return type
Warn when a return statement is used in a void function

Errors

These messages report syntactic or semantic misuse of C or C++. The compiler always displays error messages. Errors suppress object code for the module containing the error and prevent linking, but they allow parsing to continue to detect other possible errors. Some representative error messages are:

Option Summary

Use the following compiler options to control remarks, warnings, and errors:

Option Result
-w Suppress all warnings
-w0 Display only errors
-w1 Display only errors and warnings
-w2 Display errors, warnings, and remarks
-Wbrief Display brief one-line diagnostics
-Wcheck Enable more strict diagnostics