Long story

Discussion in 'Java' started by jupiter, Dec 28, 2006.

  1. jupiter

    jupiter Guest

    I had a case where Long.toString(); in my method compiled and I
    could not understand why such behavior. Since the no-arg overload
    of toString() is an instance version, the class appeared to be
    using the instance version.

    ???

    Dumb gringo had passed an arg to the method named Long. How sweet
    is that? When I wrote Long.toString() the compiler was deciding to
    use the arg Long, not the wrapper Long.

    Dumb dee dumb dumb. Just because it's legal don't mean it's right.

    Lingering issue: I'm not sure about the rules of precedence and why
    it chose the arg Long instead of the wrapper Long.

    Was that story too Long? Maybe I should have tried it with Short.

    - Martin Short.
    jupiter, Dec 28, 2006
    #1
    1. Advertising

  2. jupiter

    Daniel Pitts Guest

    jupiter wrote:
    > I had a case where Long.toString(); in my method compiled and I
    > could not understand why such behavior. Since the no-arg overload
    > of toString() is an instance version, the class appeared to be
    > using the instance version.
    >
    > ???
    >
    > Dumb gringo had passed an arg to the method named Long. How sweet
    > is that? When I wrote Long.toString() the compiler was deciding to
    > use the arg Long, not the wrapper Long.
    >
    > Dumb dee dumb dumb. Just because it's legal don't mean it's right.
    >
    > Lingering issue: I'm not sure about the rules of precedence and why
    > it chose the arg Long instead of the wrapper Long.
    >
    > Was that story too Long? Maybe I should have tried it with Short.
    >
    > - Martin Short.


    Funny story, although the term gringo is a little offensive.

    Better than BigInteger Story :)
    Daniel Pitts, Dec 28, 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. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    657
    Eric Sosman
    Jul 8, 2003
  2. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,174
    Peter Shaggy Haywood
    Sep 20, 2005
  3. Jeroen
    Replies:
    13
    Views:
    801
    Jeroen
    Apr 26, 2007
  4. Mathieu Dutour

    long long and long

    Mathieu Dutour, Jul 17, 2007, in forum: C Programming
    Replies:
    4
    Views:
    457
    santosh
    Jul 24, 2007
  5. Bart C

    Use of Long and Long Long

    Bart C, Jan 9, 2008, in forum: C Programming
    Replies:
    27
    Views:
    778
    Peter Nilsson
    Jan 15, 2008
Loading...

Share This Page