On 25/04/2012 17:10, Andrej Mitrovic wrote:
On 4/25/12, Stewart Gordon<smjg_1...@yahoo.com>  wrote:
Even if it's left over from debugging, it
looks silly, and
might lead other people reading the code to believe something's wrong.

There's about a million ways to make code unreadable, and nobody
writes pitch-perfect code that has absolutely no leftover code or
comments.

Exactly.  But good-quality compilers help programmers in that direction in 
various ways.

And what if you're refactoring and you do multiple builds every couple
of seconds? You add a variable, remove it, etc etc. Enabling this
warning will just make for a noisy compiler.

But if the spec stays the same, the compiler needs to generate an _error_ for it in order to conform. If this statement is removed from the spec, then it will be a matter of adding a warning. But this is part of why warnings are optional in DMD. By enabling warnings in the compiler in the first place, the programmer is asking to be informed of things like this.

Keeping variables clean
is the responsibility of the programmer and not the compiler.

If it doesn't affect the semantics of code the compiler should shut
up. Please don't turn the compiler into a reincarnation of Clippy.

So you think that

import std.stdio;
void main() {
    int a, b;
    a + b;
    return;
    writefln("Hello, world!");
}

should generate no errors or warnings whatsoever?

Stewart.

Reply via email to