Docs: Section on local variables
Jonathan M Davis
jmdavisProg at gmx.com
Thu Apr 26 13:17:34 PDT 2012
On Thursday, April 26, 2012 19:46:38 Stewart Gordon wrote:
> I can begin to see why it makes errors for unused variables a bad idea. But
> why no warnings? Obviously the user wouldn't like to see warnings thrown
> at them when they try using templates with such constraints. But:
The existence of -w makes it so that warnings are just as bad as errors for
something like this, since it makes warnings errors. The result is that there
is a minimal difference between warnings and errors with dmd.
And honestly, while I agree that code shouldn't normally have unused
variables, I so rarely see code with any that I think that it's a complete
non-issue in general. 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).
I'd much prefer that warning about that sort of thing be left up to a
lint-like tool.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list