declaration of variables?

Steven Taschuk staschuk at telusplanet.net
Sun Feb 16 20:13:15 EST 2003


Quoth Jp Calderone:
> On Sun, Feb 16, 2003 at 05:39:06PM -0700, Steven Taschuk wrote:
  [...]
> > Your latter point of orphaned declarations, however, has an easy
> > answer: a compiler which issues errors for variables used but not
> > declared should also issue warnings for variables declared but not
> > used.
  [...]
>     warnings.c:3: warning: unused variable 

Yup, gcc does the Right Thing, and it's not alone.

>   Maybe if it generated errors, instead... ;)
> 
>   There's another easy answer, of course - blame the lazy coders instead of
> the language construct.  I think the "correct" course is a probably happy
> medium somewhere 'twain the two.

Nicely put.

My feeling is that if one's compiler issues warnings for orphaned
declarations, eliminating them is de rigueur.  (If one's compiler
doesn't, changing compilers is mandatory and urgent.)

-- 
Steven Taschuk           |   7\ 7'Z {&~         .     St. George
staschuk at telusplanet.net |     Y r          --/hG-      &  the
                         | (__/ )_             1^1`     Dragon





More information about the Python-list mailing list