When the Treat All Warnings as Errors option is on, the compiler
treats all warnings as though they were errors. It will not compile a
file until all warnings are resolved.
treats all warnings as though they were errors. It will not compile a
file until all warnings are resolved.
The Treat All Warnings as Errors option corresponds to the pragma
warning_errors
warning_errors
1) Illegal Pragmas
If the Illegal Pragmas option is on, the compiler displays a warning
when it encounters an illegal pragma. For example, these pragma
statements generate warnings:
when it encounters an illegal pragma. For example, these pragma
statements generate warnings:
#pragma near_data off // WARNING: near_data is not a pragma.2) Empty Declarations
#pragma far_data select // WARNING: select is not defined
#pragma far_data on // OK
If the Empty Declarations option is on, the compiler displays a
warning when it encounters a declaration with no variable name.
For example:
int ; // WARNING3) Possible Errors
int i; // OK
If the Possible Errors option is on, the compiler checks for some
common typographical mistakes that are legal C syntax but that
may have unwanted side effects, such as putting in unintended
semicolons or confusing = and ==. The compiler generates a warning
if it encounters one of these:
- An assignment in a logical expression or the condition in an
if, while, or for expression. This check is useful if you frequently
use = when you meant to use ==. For example:
- if (a=b) f(); // WARNING: a=b is an assignment
if ((a=b)!=0) f(); // OK: (a=b)!=0 is a comparison
if (a==b) f(); // OK: (a==b) is a comparison
- An equal comparison in a statement that contains a single expression.
This check is useful if you frequently use == when
you meant to use =. For example: - a == 0; // WARNING: This is a comparison.
a = 0; // OK: This is an assignment
No comments:
Post a Comment