Unused variables and bugs

Brian Schott via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 22 17:03:31 PDT 2014


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)


More information about the Digitalmars-d mailing list