2009-11-05 12:27:41 UTC
This issue cropped up on the MinGW Developer's ML, only yesterday:
http://thread.gmane.org/gmane.comp.gnu.mingw.devel/3520
The warning occurs because the logical expression, as it stands, contains an ambiguous mix of AND and OR subexpressions, which the compiler cannot be certain to evaluate with the precedence the programmer intended, without parenthesis to specify this intent.
Your parenthesis just affirm what the compiler will assume, but is that really what the programmer intended? I think not; more likely is:
while( *p && (IsWhiteSpace( *p ) || *p == '\n' || *p == '\r') )
As it happens, in this case, the ORed subexpressions are redundant, so don't affect the outcome anyway, but the compiler has no way to know that; the entire expression may be safely simplified to:
while( *p && IsWhiteSpace( *p ) )
(ignoring the redundancy within IsWhiteSpace() itself -- do you know of any implementation of isspace() which doesn't satisfy the POSIX requirement that '\n' and '\r' are included in the set of whitespace characters?)