Unused variables and bugs

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 22 17:16:05 PDT 2014


On 08/23/2014 02:03 AM, Brian Schott wrote:
> On Friday, 22 August 2014 at 23:32:54 UTC, Timon Gehr wrote:
>> The correlation only indicates that poor code tends to have more
>> unused variables. If one eliminates unused variables just for the sake
>> of eliminating unused variables, code quality will most likely not
>> magically increase.
>
> I would argue that eliminating unused variables always improves code
> quality. If you have unused variables you are wasting the compilers
> time, confusing anybody who reads your code, and possibly making the
> resulting binary less efficient. Nobody is arguing that it is the
> mythical vampire-slaying silver bullet. (At least I hope not)

Yah, code quality wasn't specific enough. I meant code correctness.


More information about the Digitalmars-d mailing list