On #<, #> and -w (void context warnings)

Discussion in 'Ruby' started by Eero Saynatkari, Sep 30, 2006.

  1. --xtx0sNU5lZ46KfgK
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    Hello!=20

    Time for the weekly syntax analysis thingy. ruby -w causes
    this code to issue a warning:

    # warning: useless use of < in void context
    '/tmp/foo' < "Some text here"=20
    =20
    Same goes for #>. The problem, somewhat obviously, goes away
    when the same expression is used in a conditional position.

    I was thinking about it and there is really no way to avoid
    this assuming that the warning is considered to be useful
    for those instances where someone accidentally uses this
    type of an expression outside a conditional. =20

    --xtx0sNU5lZ46KfgK
    Content-Type: application/pgp-signature
    Content-Disposition: inline

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.5 (FreeBSD)

    iD8DBQFFHgiU7Nh7RM4TrhIRAmIJAKCqufMSgK/lusthgdBTrSQ9OQexxwCfYOy2
    TEBL0NKsw+qvc63HqEe/04Y=
    =PHOe
    -----END PGP SIGNATURE-----

    --xtx0sNU5lZ46KfgK--
     
    Eero Saynatkari, Sep 30, 2006
    #1
    1. Advertising

  2. Eero Saynatkari wrote:
    > Hello!
    >
    > Time for the weekly syntax analysis thingy. ruby -w causes
    > this code to issue a warning:
    >
    > # warning: useless use of < in void context
    > '/tmp/foo' < "Some text here"
    >
    > Same goes for #>. The problem, somewhat obviously, goes away
    > when the same expression is used in a conditional position.
    >
    > I was thinking about it and there is really no way to avoid
    > this assuming that the warning is considered to be useful
    > for those instances where someone accidentally uses this
    > type of an expression outside a conditional.


    This is a quite accurate summary.

    Kind regards

    robert
     
    Robert Klemme, Sep 30, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ollej Reemt
    Replies:
    7
    Views:
    600
    Jack Klein
    Apr 22, 2005
  2. Stig Brautaset

    `void **' revisited: void *pop(void **root)

    Stig Brautaset, Oct 25, 2003, in forum: C Programming
    Replies:
    15
    Views:
    836
    The Real OS/2 Guy
    Oct 28, 2003
  3. Replies:
    5
    Views:
    881
    S.Tobias
    Jul 22, 2005
  4. Replies:
    1
    Views:
    435
    Victor Bazarov
    May 23, 2007
  5. Florian Kaufmann

    Why isn't void context a 'real' context

    Florian Kaufmann, Dec 11, 2007, in forum: Perl Misc
    Replies:
    2
    Views:
    95
    Tad J McClellan
    Dec 13, 2007
Loading...

Share This Page