The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Branching dazed and confused

Last post 08-26-2008 7:34 AM by belgariontheking. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 08-25-2008 2:12 PM

    • Manos
    • Not Ranked
    • Joined on 08-12-2007
    • Posts 9

    Branching dazed and confused

    Code snippet from VC++ project we recently took ever from another company

    if(Cnv(GetStrLanguage(m_eLanguage)) == "NL")
    {
         m_hJob = LlJobOpen(CMBTLANG_DEFAULT);
    }
    else
    {
         m_hJob = LlJobOpen(CMBTLANG_DEFAULT);
    }

  • 08-25-2008 2:34 PM In reply to

    • movzx
    • Not Ranked
    • Joined on 07-11-2008
    • Posts 16

    Re: Branching dazed and confused

     I've written code like this before where the values I needed to work with at the time didn't exist, so I had to temporarily use the same information in both cases.Doesn't apply in all cases, but it looks like in this instance a handle is needed to continue. I don't see the big WTF.

  • 08-25-2008 2:42 PM In reply to

    Re: Branching dazed and confused

    movzx:

     I've written code like this before where the values I needed to work with at the time didn't exist...

    But I'll bet you flagged it with a TODO, or something else to remind you that it needed to be filled in...

    How do you know if you're too drunk to drive?
    If you swerve to avoid hitting a tree and then realize
    that it was the air freshener hanging from your mirror!
  • 08-25-2008 4:44 PM In reply to

    • movzx
    • Not Ranked
    • Joined on 07-11-2008
    • Posts 16

    Re: Branching dazed and confused

     Sure, but there's no real way to know from this snippet that there wasn't something in the area prompting a developer to redo the section. It may have been accidentally removed by someone who just saw code there, the function "worked", so lets remove this TODO since it must have been done.

     Just sayin it didn't seem like that big of a guffaw to me.

  • 08-25-2008 4:52 PM In reply to

    Re: Branching dazed and confused

    This would be the sort of code I'd rewrite to use a variable assigned to either CMBTLANG_DEFAULT or some other viable value so that I could just have

    m_hJob = LlJobOpen(iLangTypeCode);

    in there one time.  But that's just me.  I like writing maintainable code.

  • 08-26-2008 12:24 AM In reply to

    Re: Branching dazed and confused

     Not to derail this thread or turn it "inappropriate" or anything, but did anyone else start laughing as soon as they saw hJob?  Maybe I just have a dirty mind.

  • 08-26-2008 7:34 AM In reply to

    Re: Branching dazed and confused

    burntfuse:
    Not to derail this thread or turn it "inappropriate" or anything, but did anyone else start laughing as soon as they saw hJob?  Maybe I just have a dirty mind.
    Relax and know that all threads derail.  

    No, I didn't think that, but now I am.  Thanks!

    I guess I'm back.

    Please continue to spam the addresses below.

    PLEASE SPAM:
    jtobin@ohioinstituteofhealthcareers.edu
    jtobin@ohiobusinesscollege.edu
Page 1 of 1 (7 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems