Unused variables, better as error or warning?
Walter Bright
newshound2 at digitalmars.com
Fri Aug 20 12:35:33 PDT 2010
Jonathan M Davis wrote:
> I'm sure that there are cases where it would be nice for
> the compiler to point out that you're uselessly assigning to a variable
> (especially if you're making a useless function call too), but it would cost the
> compiler too much in complexity and cost the programmer in many other cases by
> forcing them to either ignore warnings (which they should pretty much never do)
> or throw in pointless explicit initializations rather than letting the defaults
> do their job.
Having such be errors (or warnings) makes for a very annoying experience. For
example, when you're commenting out code trying to find a problem, or when
you're generating D source code from some DSL, etc., having unused variables or
assignments happen often.
More information about the Digitalmars-d
mailing list