Stupidest code of the day

Discussion in 'Java' started by emmaps, Jan 19, 2005.

  1. emmaps

    emmaps Guest

    >>Now I have come to expect that my colleagues are still stupid enough
    >>touse the ""+ trick to convert primitives to Strings


    Whats wrong with using ""+ ?
    emmaps, Jan 19, 2005
    #1
    1. Advertising

  2. emmaps wrote:
    >>>Now I have come to expect that my colleagues are still stupid enough
    >>>touse the ""+ trick to convert primitives to Strings

    >
    > Whats wrong with using ""+ ?


    It's forcing an unnecessary conversion of an int into a String, the
    creation of a second String, and then the parsing of that String into a
    double in order to create an instance of Double.

    --
    Darryl L. Pierce <>
    Visit my webpage: <http://mcpierce.multiply.com>
    "By doubting we come to inquiry, through inquiry truth."
    - Peter Abelard
    Darryl L. Pierce, Jan 19, 2005
    #2
    1. Advertising

  3. emmaps

    Jon Caldwell Guest

    emmaps wrote:
    >>>Now I have come to expect that my colleagues are still stupid enough
    >>>touse the ""+ trick to convert primitives to Strings

    >
    >
    > Whats wrong with using ""+ ?



    I would like to submit a nomination for today's stupidest code. I hope C
    entries are eligible.

    put_bufint(&ptr, 1, atoi("92")); /* record type */
    put_bufint(&ptr, 1, atoi("1")); /* language code */
    put_bufint(&ptr, 1, atoi("0")); /* cmd accessible */

    Any ideas how to optimize this? ;-)
    Jon Caldwell, Jan 20, 2005
    #3
  4. Jon Caldwell wrote:

    > I would like to submit a nomination for today's stupidest code. I hope C
    > entries are eligible.
    >
    > put_bufint(&ptr, 1, atoi("92")); /* record type */
    > put_bufint(&ptr, 1, atoi("1")); /* language code */
    > put_bufint(&ptr, 1, atoi("0")); /* cmd accessible */
    >
    > Any ideas how to optimize this? ;-)


    put_bufint(&ptr, atoi("1"), atoi("92"));
    put_bufint(&ptr, atoi("1"), atoi("1"));
    put_bufint(&ptr, atoi("1"), atoi("0"));
    Andrea Desole, Jan 20, 2005
    #4
  5. emmaps

    Paul Tomblin Guest

    In a previous article, Jon Caldwell <> said:
    >I would like to submit a nomination for today's stupidest code. I hope C
    >entries are eligible.
    >
    > put_bufint(&ptr, 1, atoi("92")); /* record type */
    > put_bufint(&ptr, 1, atoi("1")); /* language code */
    > put_bufint(&ptr, 1, atoi("0")); /* cmd accessible */
    >
    >Any ideas how to optimize this? ;-)


    Submit it to "The Daily WTF" http://thedailywtf.com/

    --
    Paul Tomblin <> http://xcski.com/blogs/pt/
    Where a calculator on the ENIAC is equipped with 18,000 vacuum tubes and weighs
    30 tons, computers in the future may have only 1,000 vacuum tubes and weigh
    only 1 1/2 tons. ---Popular Mechanics, March 1949
    Paul Tomblin, Jan 20, 2005
    #5
    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. Joona I Palaste

    Stupidest code of the day

    Joona I Palaste, Jan 17, 2005, in forum: Java
    Replies:
    29
    Views:
    678
  2. emmaps

    Stupidest code pf the day

    emmaps, Jan 20, 2005, in forum: Java
    Replies:
    1
    Views:
    277
    Ryan Stewart
    Jan 20, 2005
  3. emmaps

    Stupidest code of the day

    emmaps, Jan 21, 2005, in forum: Java
    Replies:
    4
    Views:
    300
    Joona I Palaste
    Jan 25, 2005
  4. Replies:
    3
    Views:
    366
    brucie
    Dec 17, 2003
  5. Andy
    Replies:
    1
    Views:
    678
Loading...

Share This Page