https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425

costinc at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |costinc at gmail dot com

--- Comment #23 from costinc at gmail dot com ---
I've just been bitten by this.

The problem isn't the attribute, it's the on-by-default warning. Why force
people to move from one convention of ignoring expression results to another?

I've just wasted one hour of my life. On the opposite side of the scale there
are people using prettier ways to ignore expression results. I really hope
someone, somewhere, was deterred from ignoring a result using a much uglier
method than (void) and, because of it, fixed a real bug (this must be the only
scenario that favors disallowing (void), deterrence through repugnance, am I
wrong?).

Note that casting to void seems to be mentioned in the standard precisely for
discarding expression results:
"Any expression can be explicitly converted to type “cv void.” The expression
value is discarded."
At best, this warning should be restricted to gnu99 or similar.

And if the attribute and it's associated warning are supposed to apply only to
important security related code then where is the warning for non-security
related code? The warning name pretty clearly relates to the general problem.
Isn't that confusing?

My 2c: Clang did the right thing.

Please, at least make the warning off-by-default.

Reply via email to