Missing compiler warning?

Jonathan M Davis jmdavisProg at gmx.com
Sat Oct 19 18:14:53 PDT 2013


On Saturday, October 19, 2013 18:50:16 Chris wrote:
> A warning would be enough. The thing is I didn't want to give it
> the same name. It was meant to be the class variable but the auto
> was a leftover from a test. A warning would have been nice, à la
> "do you really want this?". I would have seen it immediately.

Warnings are pretty much always a bad idea IMHO. If you're being a responsible 
programmer, you fix all warnings, so they're ultimately not really any different 
from an error except that you can leave them alone temporarily while 
developing. It's far better to make something an error not have the compiler 
complain about it at all. lint-like tools can do additional analysis based on 
additional stuff that a programmer decides they want to look for in their code, 
but the compiler shouldn't be pointing out stuff that "might" be wrong, because 
you'll have to "fix" it whether it's wrong or not just to get the compiler to 
shut up about it.

And Walter agrees with me on this. Pretty much the only reason that warnings 
even exist in dmd is because he got pestered into adding them, and even then, 
we don't have very many. Most of them end up being warnings about stuff that 
will become errors later (rather than just making them an error immediately 
and break code).

- Jonathan M Davis


More information about the Digitalmars-d mailing list