Wish: Variable Not Used Warning

Sean Kelly sean at invisibleduck.org
Tue Jul 8 08:08:32 PDT 2008


== Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> Robert Fraser wrote:
> > Walter Bright wrote:
> >> Robert Fraser wrote:
> >>> The compiler already has full semantic knowledge of the code, and at
> >>> least some of the warnings seem like "low-hanging fruit" so why not
> >>> make the compiler act as a "mini-lint"?
> >>
> >> Generally for the reasons already mentioned.
> >>
> >> Warnings are properly in the scope of static analysis tools, which
> >> have a different purpose than a compiler.
> >
> > A compiler is not a documentation generator or a header generator, yet
> > DMD does both (with some switches). Why not the same with lint-like
> > functionality?
> Because what constitutes a proper warning is a very subjective issue,
> there is plenty of room for different ideas. If it was in the compiler,
> it would inhibit development of static analysis tools, and would confuse
> the issue of what was correct D code.

And regarding this particular issue, it's not uncommon to have unused
function parameters.  And while C++ allows them to be left out:

void fn( int ) {}

D does not.  A warning for this would be terribly annoying.


Sean



More information about the Digitalmars-d mailing list