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);
    }



  •  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.



  • @movzx said:

     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...



  •  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.



  • 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.



  •  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.



  • @burntfuse said:

    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!


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.