suggest parentheses around assignment used as truth value
Richard Earnshaw
rearnsha@arm.com
Fri Jul 3 06:15:00 GMT 1998
>
> It's rather hard to double the parentheses in error, and the form does
> visually stand out.
>
It's very easy to double the parentheses in error. You just have to have
the erroneous code inside a macro.
Somewhat simple I know, but:
#define COMPARE(X,Y) ((X)=(Y)) /* Should be == */
...
if (COMPARE(p,q)) {...} /* Should get a warning, but doesn't */
Richard.
More information about the Gcc
mailing list