-wi on default?

Jonathan M Davis jmdavisProg at gmx.com
Mon May 7 18:52:07 PDT 2012


On Tuesday, May 08, 2012 01:25:54 bearophile wrote:
> They are discussing about having -Wall on default in GCC 4.8:
> 
> http://gcc.gnu.org/ml/gcc/2012-04/msg00087.html
> http://gcc.gnu.org/ml/gcc/2012-04/threads.html#00092
> 
> In D.learn I've seen plenty of people not use -wi (or -w) in D
> programming, and this has caused some troubles.
> 
> So what do you think about having "-wi" (and even -property too)
> on default in D (and have a compiler switch to disable warnings
> on request)?

The funny thing is that what -wi does is how every other compiler I've ever 
used operates. Warnings are always on and never stop compilation. Additional 
flags may add new warnings, and others may be used to silence certain warnings, 
but dmd's default of _no_ warnings is very odd. And -w is _completely_ unique 
AFAIK. The idea of basically _adding errors_ is a bit odd. So, from the 
standpoint of how compilers typically work, Walter's choices are definitely 
odd.

That said, I increasingly agree with Walter's philosophy that something should 
either be an error or not and that warnings are flawed by nature. A good 
programmer will never leave _any_ warnings in committed code. So, nothing 
which is a warning is really any different from an error except for the fact 
that it may be reasonable to leave it alone temporarily while editing or 
debugging code. And as such, having warnings becomes seriously suspect in the 
first place - _especially_ when a warning isn't something that a programmer 
would necessarily agree needs to be fixed. They ultimately lead to bad 
programmers leaving them in, making it difficult to see new ones or see what's 
wrong in general, and it can be a royal pain to go and spend the time to clean 
up all of the existing warnings (I've done it in real world projects in Java 
and C++; I hate it).

So, I'd actually be tempted to argue for making -w the default, and ditching -
w and -wi entirely. And Walter's probably more likely to go for that then 
making -wi the default.

But certainly the normal thing to do would be to make -wi the default. It'll 
never happen, but it would be how most compilers work.

- Jonathan M Davis


More information about the Digitalmars-d mailing list