Unused variables, better as error or warning?

Jonathan M Davis jmdavisprog at gmail.com
Fri Aug 20 14:28:54 PDT 2010

On Friday, August 20, 2010 14:12:09 Walter Bright wrote:
> bearophile wrote:
> > So if you give me this warning, you are free to keep it always
> > deactivated in all your future D programs :-)
> I detest warnings because they make the language rules "fuzzy". Code should
> be legal or illegal. Wishy-washy warnings make code non-portable because
> different compilers implement different warning.

Warnings are good for things which you _should_ fix but don't have to immediately 
while working on code. So, things like unused variables or unreachable code work 
well as warnings. You fix them before you're done, but they don't stop you from 
messing around with your code (or at least don't make you make extra changes 
when messing around with your code). Other than that, I'm inclined to believe 
that they should just all be errors. They all need to be gone when the code is 
finished anyway. But I do think that warnings can be valuable for indicating 
problems that you can temporarily ignore while rearranging and debugging code.

- Jonathan M Davis

More information about the Digitalmars-d mailing list