Docs: Section on local variables

bearophile bearophileHUGS at lycos.com
Thu Apr 26 14:52:48 PDT 2012


Jonathan M Davis:

> I don't even know the last time that I saw an unused
> variable left in code (except for on purpose in something like 
> isInputRange).

So if the compiler warns you of unused variables, this will not 
cause your code almost no warnings. No troubles for you. For 
uncommon situations like isInputRange a specific annotation 
solves the problem cleanly.


> I'd much prefer that warning about that sort of thing be left 
> up to a lint-like tool.

How many C/C++ programmers do you know that use lints? I think 
not enough. The Microsoft C++ compiler and Clang are adding more 
and more compile-time tests, replacing lints, this a trend D 
designers can't ignore. So saying "leave it to lints" it's almost 
like saying "ignore the problem".

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list