Missing compiler warning?

Jonathan M Davis jmdavisProg at gmx.com
Mon Oct 21 04:49:14 PDT 2013


On Monday, October 21, 2013 12:50:44 Chris wrote:
> So the solution would be an additional layer that can be turned
> on / off. Warnings like "unused variable" or "shadowing class
> declaration" are quite useful. I don't see any other cases where
> a warning would be nice (at the moment).

Perhaps, but Walter is against adding much in the way of switches to dmd, and 
he has pretty much the same position on warnings that I do. Also, with a 3rd 
party tool, it'll be a lot easier to get warnings on exactly what you want, 
whereas with the compiler, you have to convince Walter that it should be a 
warning. Having a configurable tool for additional checks is just more flexible 
and avoids all of the arguments over what should and should be a warning.

Also, because of -w (which makes a warning an error), it would actually be 
_very_ bad for something like "unused variable" to be a warning, because then 
it would be an error, which would result in a _lot_ of traits failing to 
compile, because it's _very_ common for those to have unused variables. It 
also would cause problems with RAII. Ideally, -w wouldn't even exist, since it 
essentially changes what is and isn't legal in the language, but the fact that 
it does exist makes it that much more precarious to add warnings to the 
compiler.

- Jonathan M Davis


More information about the Digitalmars-d mailing list