[cfe-dev] How can I use the result of a void expression? :p

Keith Bauer onesadcookie at gmail.com
Mon Aug 27 13:51:16 PDT 2007

My point is that in my mind, the warning is there to tell the
programmer that they've probably done something stupid.  In the case
of an expression without side effects, that's clearly the case
(whether the result is void or not).  Even in the situation where the
expression is nonvoid, if it has side effects, it's probably still
doing what I want.

Since the spec allows ?: to work on void, it's obviously intended that
it can be used as syntactic shorthand for an if statement.  Why
shouldn't it be usable for expressions which happen to be nonvoid, but
where the side-effect is the more important part - printf/fprintf for

Anyway, obviously, you're the ones with commit access, so you get to
make the final decision ;)


More information about the cfe-dev mailing list