Controls the recognition of possible unintentional logical errors.
#pragma warn_possunwant on | off | reset
If you enable this pragma, the compiler checks for common, unintended logical errors:
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. */
a == 0; // WARNING: This is a comparison. a = 0; // OK: This is an assignment, no warning
For example, the listing below, generates a warning message.
i = sockcount();
while (--i); /* WARNING: empty loop. */
matchsock(i);
If you intended to create an infinite loop, put white space or a comment between the while statement and the semicolon. The statements in the listing below, suppress the above error or warning messages.
while (i++) ; /* OK: White space separation. */ while (i++) /* OK: Comment separation */ ;
By default, this pragma is off .