On 3/26/2011 6:28 PM, bearophile wrote:
Walter:
D already does this. and this.
But not this:
New -Wunused-but-set-variable and -Wunused-but-set-parameter warnings were
added for C, C++, Objective-C and Objective-C++. These warnings diagnose
variables respective parameters which are only set in the code and never
otherwise used. Usually such variables are useless and often even the value
assigned to them is computed needlessly, sometimes expensively. The
-Wunused-but-set-variable warning is enabled by default by -Wall flag and
-Wunused-but-set-parameter by -Wall -Wextra flags.<
This is quite deliberate. These kinds of errors tend to be very annoying when
developing code.
The optimizer removes those as "dead assignments", so no value is computed
needlessly or expensively.