Re: is -w really useful?



Wybo Dekker wrote:
I would like to use the -w commandline option always, but any useful output is always obscured by message from the standard libraries:

For example:

/usr/local/lib/ruby/gems/1.8/gems/rio-0.3.7/lib/rio/if/grande.rb:404: warning: useless use of > in void context
/usr/local/lib/ruby/gems/1.8/gems/rio-0.3.7/lib/rio/if/grande.rb:580: warning: useless use of < in void context
/usr/local/lib/ruby/1.8/tk.rb:2313: warning: redefine encoding=
/usr/local/lib/ruby/1.8/tk.rb:2316: warning: redefine encoding
/usr/local/lib/ruby/1.8/tk/font.rb:718: warning: instance variable @compoundfont not initialized
/usr/local/lib/ruby/1.8/tk/font.rb:671: warning: instance variable @compoundfont not initialized
/usr/local/lib/ruby/1.8/tk/font.rb:718: warning: instance variable @compoundfont not initialized
/usr/local/lib/ruby/1.8/tk/font.rb:671: warning: instance variable @compoundfont not initialized
/usr/local/lib/ruby/gems/1.8/gems/rio-0.3.7/lib/rio/rl/uri.rb:78: warning: method redefined; discarding old base=
/usr/local/lib/ruby/gems/1.8/gems/rio-0.3.7/lib/rio/cp.rb:209: warning: useless use of < in void context
/usr/local/lib/ruby/gems/1.8/gems/rio-0.3.7/lib/rio/cp.rb:309: warning: useless use of > in void context

Should such messages not be banned?


Some warnings are really just informational. For example, redefining a method isn't 'wrong,' and it can be how your program is supposed to function. Or having an uninitialized instance variable might not matter - after all, I don't think there is a difference between that and setting it to nil.

However, it could be dangerous or unintentional, so you get a warning. As with all debugging output, you have to filter through it sometimes.

-Justin


.



Relevant Pages

  • Re: jabba the tuh
    ... Wade Ward wrote: ... what is this warning telling me: ... Useless use of a constant in void context at jabba1.pl line 57. ...
    (comp.lang.perl.misc)
  • Re: junk after endif
    ... > action that this is NOT a warning. ... > However it's decided, to squish the warning or to squish the tags, ... > it's unacceptable to leave those semantically useless warnings laying ... > about, hiding real problems. ...
    (freebsd-current)
  • Re: A problem with precedence
    ... Because Perl is more often wrong about this warning than it is right. ... print interpreted as function at foo line 2. ... Useless use of multiplication in void context at foo line 1. ...
    (comp.lang.perl.misc)
  • iterating array; useless use of private variable
    ... generates a warning "useless use of private variable in void context" at ... Can anyone explain why the warning message? ... print "patient shows high probability of xxx condition.\n"; ...
    (perl.beginners)
  • Re: Useless use of a variable in a void context
    ... Then either you are transcribing wrong, or that book is useless. ... Did you read the description of the warning in `perldoc perldiag`? ... you're uselessly using $z in a void context as well. ... So this is functionally equivalent ...
    (perl.beginners)