### Common Errors

If you enable the Possible Errors setting, the compiler generates a warning if it encounters common errors such as the following:

- An assignment in either a logical expression or the conditional portion of an if, while, or for expression. This warning is useful if you use = when you mean to use ==. An example of confusing = and == in comparisons:

> if (a=b) f(); // WARNING: a=b is an assignment
> if ((a=b)!=0) f(); // OK: (a=b)!=0 is a comparison, no warning
> if (a==b) f(); // OK: (a==b) is a comparison, no warning

- An equal comparison in a statement that contains a single expression. This check is useful if you use == when you meant to use =. An example of confusing = and == operators in assignments:

> a == 0; // WARNING: This is a comparison.
> a = 0; // OK: This is an assignment, no warning

- A semicolon (;) directly after a while, if, or for statement. For example, the following statement generates a warning and is probably an unintended infinite loop:

> while (i++); // WARNING: Unintended infinite loop

> If you intended to create an infinite loop, put white space or a comment between the while statement and the semicolon.

> These statements suppress the above errors or warnings.

> while (i++) ; // OK: White space separation, no warning
> while (i++) /*: Comment separation, no warning */ ;

The Possible Errors setting corresponds to the pragma warn_possunwant. To check this setting, use __option (warn_possunwant).

See Checking Option Settings for information on how to use this directive.