• Drew (unregistered)

    DO NOT REMOVE THIS COMMENT! The Daily WTF is skipping the Real WTF without it. Very weird.

  • sponk (unregistered)

    That's a bit of a mild wtf. Someone isn't very good at programming. Oh no. At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.

  • jammy (unregistered)

    Maybe it was because of... things.

  • (cs) in reply to Drew
    Drew:
    DO NOT REMOVE THIS COMMENT! The Daily WTF is skipping the Real WTF without it. Very weird.

    '******************************************************* '***** DO NOT REMOVE THE APOSTROPHE AND STARS ***** '***** Program will not compile without them ***** '***** Very weird. ***** '*******************************************************

    Edit: Fail :(

  • Raw (unregistered)

    I've seen that problem happen occasionally in some older VB version (probably VB4, it was buggy as hell). I never managed to figure out the logic behind it, but it certainly did happen, and the solution was to put an empty Else clause.

    So, there is a WTF, but it's not the programmer, it's Microsoft.

  • Flipper (unregistered) in reply to Raw
    Raw:
    I've seen that problem happen occasionally in some older VB version (probably VB4, it was buggy as hell). I never managed to figure out the logic behind it, but it certainly did happen, and the solution was to put an empty Else clause.

    So, there is a WTF, but it's not the programmer, it's Microsoft.

    No, the WTF is the programmer, who has heard at least 17,000 times that Microsoft == WTF^WTF^2, but continues to use it. And some don't even stop there, working hard to staunchly defend the sloppiest crud in the known universe.

  • (cs)

    That's not so bad... inexperienced programmer.

    I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:

    int x = 1;
    /**++++++++++++++++++++++++++++++++++++++++++++++++++++
     ++ This is a long comment of a lot of text that     ++
     ++ had absolutely no redeeming value except that    ++
     ++ it could easily */x++/** mislead you into making ++
     ++ your eye skip right past the relevant part in    ++
     ++ the middle of the block of unending comments.    ++
     ++++++++++++++++++++++++++++++++++++++++++++++++++++*/;
    

    After that one, we learned to look for the telltale comment-with-semicolon and then scanned backwards.

    For those who care, the guy was indeed sabotaging the code, and was fired 3 weeks later (big corp, wheels grind slowly).

  • (cs) in reply to snoofle
    snoofle:
    That's not so bad... inexperienced programmer.

    I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:

    int x = 1;
    /**++++++++++++++++++++++++++++++++++++++++++++++++++++
     ++ This is a long comment of a lot of text that     ++
     ++ had absolutely no redeeming value except that    ++
     ++ it could easily */x++/** mislead you into making ++
     ++ your eye skip right past the relevant part in    ++
     ++ the middle of the block of unending comments.    ++
     ++++++++++++++++++++++++++++++++++++++++++++++++++++*/;
    

    I think I just found my new programming style.

  • Bob (unregistered) in reply to snoofle
    snoofle:
     ++ it could easily */x++/** mislead you into making ++
    
    Awesome! I'm going to start using that.
  • (cs) in reply to Raw
    Raw:
    I've seen that problem happen occasionally in some older VB version (probably VB4, it was buggy as hell). I never managed to figure out the logic behind it, but it certainly did happen, and the solution was to put an empty Else clause.

    I can believe it. I'm curious though, would this mean that the compiler bounces back an error without it, the program would issue a runtime exception, or is it executing everything past the end if only if the condition is true.

  • (cs) in reply to sponk
    sponk:
    That's a bit of a mild wtf. Someone isn't very good at programming. Oh no. At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.

    Isn't that kind of, the essence of TDWTF? People who are not very good at programming?

    Cargo Cult Programming is never anything other than a WTF. If you don't know WHY something works, find out.

  • Raw (unregistered) in reply to Flipper
    No, the WTF is the programmer, who has heard at least 17,000 times that Microsoft == WTF^WTF^2, but continues to use it.

    Well, in most workplaces, you really don't get the option to pick your favourite language.

    I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:

    Now, that's why you use an editor which color-codes the code, and set it to display comments with another background color.

    I can believe it. I'm curious though, would this mean that the compiler bounces back an error without it, the program would issue a runtime exception, or is it executing everything past the end if only if the condition is true.

    Now, this was a decade ago, so my memory is kind of blurry, but when I got it, I got it in a nested if, which meant that it skipped to the wrong endif, and the error occured later. Took me a while to hunt it down, and a lot of swearing to try to find out WTF happened and why.

    Cargo Cult Programming is never anything other than a WTF. If you don't know WHY something works, find out.

    Unless you have a way overdue deadline. Then you just ship it and check it out later.

  • Frzr (unregistered) in reply to snoofle

    int fancy_check(int *x, int *y) { if (y==0 / can't work with y=0 */ || *x/*y==y / can't work on squares */ || x==3) / I hate the number three */ return 0; else return 1; }

    int main(int argc, char *argv[]) { int x,y; x=0; y=1; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y)); x=9; y=3; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y)); return 0; }

  • SomeGuy (unregistered) in reply to Raw
    Raw:
    Unless you have a way overdue deadline. Then you just ship it and check it out later.

    How often does checking it out later actually happen?

  • No one of importance (unregistered) in reply to Voodoo Coder

    Have a look at the principles of job-extension methodology: "How to Write Unmaintainable Code,"

    http://freeworld.thc.org/root/phun/unmaintain.html

  • Matt (unregistered) in reply to T $

    I'll second it... I remember running into the problem as well. Not sure which version of VB as I dealt with VB3-->VB6 but the problem definately existed. Totally weird, could have been the compiler or IDE, but they still had less bugs and crashes than Visual Studio 2008 SP1.

  • Raw (unregistered) in reply to SomeGuy
    SomeGuy:
    How often does checking it out later actually happen?

    Every time it later blows up unexpectedly.

    That's the problem when the boss isn't a programmer, "it works at the moment" is good enough for the boss.

  • (cs)

    How exactly does writing software that can be consistent sold for enough money to keep a company running NOT constitute "real-world experience"??

    If anything, it's people who don't consider stupid cargo cult programming to be absolutely normal and something you have to expect and deal with who are lacking "real-world experience".

  • TRWTF (unregistered) in reply to chadsexington
    chadsexington:
    snoofle:
    That's not so bad... inexperienced programmer.

    I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:

    int x = 1;
    /**++++++++++++++++++++++++++++++++++++++++++++++++++++
     ++ This is a long comment of a lot of text that     ++
     ++ had absolutely no redeeming value except that    ++
     ++ it could easily */x++/** mislead you into making ++
     ++ your eye skip right past the relevant part in    ++
     ++ the middle of the block of unending comments.    ++
     ++++++++++++++++++++++++++++++++++++++++++++++++++++*/;
    

    I think I just found my new programming style.

    And you have not submitted this as a story because...? Hell, just spill it here in the comments. Everyone knows the coder based WTF gets less than half the views of the blue bar stories anyway.

  • (cs) in reply to Raw
    Raw:
    I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:

    Now, that's why you use an editor which color-codes the code, and set it to display comments with another background color.

    Today, yes. But that happened before the days of IDEs. You had two windows: vi and the debugger, and all the debugger showed was (pseudo)

    sto x,1 inc x whatever-came-next

    Then you looked at the code window and had to find it in the jumble of comments.

  • ricecake (unregistered) in reply to No one of importance
    No one of importance:
    Have a look at the principles of job-extension methodology: "How to Write Unmaintainable Code,"

    http://freeworld.thc.org/root/phun/unmaintain.html

    Here's the updated version: http://mindprod.com/jgloss/unmain.html

  • (cs) in reply to TRWTF
    TRWTF:
    And you have not submitted this as a story because...? Hell, just spill it here in the comments. Everyone knows the coder based WTF gets less than half the views of the blue bar stories anyway.
    Sorry, I didn't think it was a WTF so much as an infantile fool throwing a tantrum.
  • PT (unregistered)

    I've worked on VB3 code way back when, where the developer actually showed me that removing a comment caused the app to shut down when it was to be executed. it was making a lot of calls to C code, and for somereason that one method needed:

    'do not delete this comment, or try a compile wihtout it beforechecking in to sourcesafe

  • (cs) in reply to snoofle
    snoofle:
    Today, yes. But that happened before the days of IDEs. You had two windows: vi and the debugger
    This is VB we're talking about. At my first professional coding job, I assumed we would be using C++, but was told that the company used VB for rapid application development. VB4 was just being released at that time, and I had to do a quick ramp-up with it. As I recall, the IDE displayed comments in a different color by that time.

    Addendum (2009-06-01 10:27): Oops... my mistake; sorry. Note to self: read more carefully next time.

  • (cs) in reply to snoofle
    snoofle:
    For those who care, the guy was indeed sabotaging the code, and was fired 3 weeks later (big corp, wheels grind slowly).

    Another reason to use CVS and the email on commit plugin. If I ever see a comment like this I'll give you gummy bears to play while you wait for your FIRED email.

  • Zarkonnen (unregistered) in reply to chadsexington

    Literate programming?

    ducks

  • Shinobu (unregistered)

    I still use VB4 today. The main reason is that the IDE is up within seconds, so very nice if I want to hack up a quicky. Although I've found some weird things, on the whole I must say that it's very robust, especially considering that a) it's 2009 now and it still works with all the new things I throw at it even though it came out in 1995 or so and b) that I'm a bloody code contortionist who likes to do strange low-level things for a hobby.

  • (cs) in reply to Shinobu
    Shinobu:
    I still use VB4 today. The main reason is that the IDE is up within seconds, so very nice if I want to hack up a quicky.
    I liked the IDE for VB4, with its arrangement of individual windows. The next version, VB97, started using the MDI and child windows, and it's been that way ever since. But I don't get using VB4. If you don't want to go to .Net, why not at least move up to VB6?
  • Steve (unregistered)

    Reminds me of a time when someone left a comment in the code about how the error handling sucked (VB 6).

    There was a follow-up comment from my supervisor. Something along the lines of "what kind of an a-hole would leave a comment complaining about the error-handling without bothering to fix it? come and discuss this with me if you have the guts."

  • (cs)

    As expected, this is a comment as expected.

  • Old fart (unregistered)

    It may be related to a known bug in VB6 that occurs if an in-line If statement is nested in an If / End If block, e.g.:

    If blnCondition1 then If blnCondition2 then (do something here on this line Else (do something else here) End If

    The nested If must be accompanied with a corresponding End If to avoid the bug. Don't know how this got past the QA when VB6 was released

  • aristos_achaion (unregistered) in reply to Voodoo Coder
    Voodoo Coder:
    sponk:
    That's a bit of a mild wtf. Someone isn't very good at programming. Oh no. At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.

    Isn't that kind of, the essence of TDWTF? People who are not very good at programming?

    Cargo Cult Programming is never anything other than a WTF. If you don't know WHY something works, find out.

    Usually there's some kind of hubris or massive ineptitude forming the core of the WTF...in this case, it's mild inexperience and laziness. Evidently, it didn't work without the Else, so he put one in, and commented his change.

  • aristos_achaion (unregistered) in reply to Code Dependent
    Code Dependent:
    Shinobu:
    I still use VB4 today. The main reason is that the IDE is up within seconds, so very nice if I want to hack up a quicky.
    I liked the IDE for VB4, with its arrangement of individual windows. The next version, VB97, started using the MDI and child windows, and it's been that way ever since. But I don't get using VB4. If you don't want to go to .Net, why not at least move up to VB6?
    Personally, I don't get using VB, or Windows for that matter. But different strokes for different folks, I guess.
  • (cs) in reply to snoofle
    snoofle:
    That's not so bad... inexperienced programmer.

    I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:

    int x = 1;
    /**++++++++++++++++++++++++++++++++++++++++++++++++++++
     ++ This is a long comment of a lot of text that     ++
     ++ had absolutely no redeeming value except that    ++
     ++ it could easily */x++/** mislead you into making ++
     ++ your eye skip right past the relevant part in    ++
     ++ the middle of the block of unending comments.    ++
     ++++++++++++++++++++++++++++++++++++++++++++++++++++*/;
    

    After that one, we learned to look for the telltale comment-with-semicolon and then scanned backwards.

    For those who care, the guy was indeed sabotaging the code, and was fired 3 weeks later (big corp, wheels grind slowly).

    Hah, that's amusing. I spend a lot of my time undoing that sort of sabotage, and that's really an amateurish way of doing it...Though it is somewhat clever, anyone who looked at it would immediately know that that was intentional obfuscation.

    It's a lot easier to just move stuff around weirdly, and use a lot of duplicate filenames/variable names and crap like that.

  • Zer0 (unregistered) in reply to sponk
    sponk:
    That's a bit of a mild wtf. Someone isn't very good at programming. Oh no. At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.

    Uh, if you've ever done that yourself, get out of this industry. I really don't ever want to run across and fix our code. Thanks =)

  • Ray (unregistered) in reply to Frzr
    Frzr:
    int fancy_check(int *x, int *y) { if (*y==0 /* can't work with y=0 */ || *x/*y==*y /* can't work on squares */ || *x==3) /* I hate the number three */ return 0; else return 1; }

    int main(int argc, char *argv[]) { int x,y; x=0; y=1; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y)); x=9; y=3; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y)); return 0; }

    Color highlighting shows the mistake right away. Nice try. :)

  • Jasmine (unregistered) in reply to aristos_achaion
    aristos_achaion:
    Voodoo Coder:
    sponk:
    That's a bit of a mild wtf. Someone isn't very good at programming. Oh no. At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.

    Isn't that kind of, the essence of TDWTF? People who are not very good at programming?

    Cargo Cult Programming is never anything other than a WTF. If you don't know WHY something works, find out.

    Usually there's some kind of hubris or massive ineptitude forming the core of the WTF...in this case, it's mild inexperience and laziness. Evidently, it didn't work without the Else, so he put one in, and commented his change.

    They did what needed to be done to make it work, and it's hard to disagree with that. The RWTF is how often that happens and is never re-visited for improvement - and the fact that it did work without the else.

  • (cs) in reply to Jasmine
    Jasmine:
    They did what needed to be done to make it work, and it's hard to disagree with that. The RWTF is how often that happens and is never re-visited for improvement - and the fact that it did work without the else.

    How is it a WTF that it did work without the else ? There isn't any code in the else to do anything, so it would perform the same way in both cases.

    Its kind of lame wtf today, it just looks like some comments that somebody new to debugging probably put in there. Even though its senseless and should be removed, its just the mark of a beginner. It has no real affect, as already mentioned. The main issue is that debugging comments made it into source control (if one is used). These should be reviewed before committing.

  • (cs) in reply to Old fart
    Old fart:
    It may be related to a known bug in VB6 that occurs if an in-line If statement is nested in an If / End If block, e.g.:

    If blnCondition1 then If blnCondition2 then (do something here on this line Else (do something else here) End If

    The nested If must be accompanied with a corresponding End If to avoid the bug. Don't know how this got past the QA when VB6 was released

    That looks more like a dangling else to me...

    np: The Wooden Birds - False Alarm (Magnolia)

  • Jasmine (unregistered) in reply to pitchingchris
    pitchingchris:
    Jasmine:
    They did what needed to be done to make it work, and it's hard to disagree with that. The RWTF is how often that happens and is never re-visited for improvement - and the fact that it did work without the else.

    How is it a WTF that it did work without the else ? There isn't any code in the else to do anything, so it would perform the same way in both cases.

    Its kind of lame wtf today, it just looks like some comments that somebody new to debugging probably put in there. Even though its senseless and should be removed, its just the mark of a beginner. It has no real affect, as already mentioned. The main issue is that debugging comments made it into source control (if one is used). These should be reviewed before committing.

    I just think it's suspicious that someone obviously had a problem without putting the else, and then someone else later on had it work fine. I've been doing this stuff for 25 years, and I've seen this kind of thing a few times, and the one reasonable explanation for it has been updates to the compilers/interpreters between the first and second revisions. When you can't find an explanation like that, it is just suspicious and you go with it. In business you do whatever it takes to get the job done, and if you don't understand it, then you're welcome to have a bad feeling about that, but you're going to do it anyway. I vaguely recall VB doing this kind of thing - it would cause a runtime error.

    This is definitely a WTF - but you see this kind of thing occasionally. I've seen perfect code maybe once in my life - and I wrote it, in college - which is the only place perfect coding happens on a regular basis.

  • jacmoe (unregistered)

    I really don't think it's a WTF. It was a bug in VB, so they worked around it. And because they didn't want to look stupid, or someone removing the empty else statement, they wrote a comment. A WTF comment, but a comment none the less. :)

  • Kluge Doctor (unregistered) in reply to snoofle
    snoofle:
    int x = 1;
    /**++++++++++++++++++++++++++++++++++++++++++++++++++++
     ++ This is a long comment of a lot of text that     ++
     ++ had absolutely no redeeming value except that    ++
     ++ it could easily */x++/** mislead you into making ++
     ++ your eye skip right past the relevant part in    ++
     ++ the middle of the block of unending comments.    ++
     ++++++++++++++++++++++++++++++++++++++++++++++++++++*/;
    
    int x = 1;
    /**++++++++++++++++++++++++++++++++++++++++++++++++++++
     ++ This is a long comment of a lot of text that     ++
     ++ had absolutely no redeeming value except that    ++
     ++ it could easily */x++;/** mislead you into making ++
     ++ your eye skip right past the relevant part in    ++
     ++ the middle of the block of unending comments.    ++
     ++++++++++++++++++++++++++++++++++++++++++++++++++++*/;
    

    Fixed.

  • Been there done that (unregistered) in reply to jacmoe

    This was a rare bug in VB3 during 1993-1994 and was fixed in VB4 by 1995. The workaround was as described int eh original code above.

  • Redundant Semicolon (unregistered) in reply to Kluge Doctor
    Kluge Doctor:
    snoofle:
    int x = 1;
    /**++++++++++++++++++++++++++++++++++++++++++++++++++++
     ++ This is a long comment of a lot of text that     ++
     ++ had absolutely no redeeming value except that    ++
     ++ it could easily */x++/** mislead you into making ++
     ++ your eye skip right past the relevant part in    ++
     ++ the middle of the block of unending comments.    ++
     ++++++++++++++++++++++++++++++++++++++++++++++++++++*/;
    
    int x = 1;
    /**++++++++++++++++++++++++++++++++++++++++++++++++++++
     ++ This is a long comment of a lot of text that     ++
     ++ had absolutely no redeeming value except that    ++
     ++ it could easily */x++;/** mislead you into making ++
     ++ your eye skip right past the relevant part in    ++
     ++ the middle of the block of unending comments.    ++
     ++++++++++++++++++++++++++++++++++++++++++++++++++++*/;
    

    Fixed.

    You shouldn't fix what is not broken :)

  • aggle-rithm (unregistered) in reply to snoofle
    snoofle:
    For those who care, the guy was indeed sabotaging the code, and was fired 3 weeks later (big corp, wheels grind slowly).

    "I swear to God, if you sabotage any more code, I will start the disciplinary process!!!"

  • (cs)

    Probably the 'End If' was on the same line as one of the comment lines :P To make it worse, line wrapping probably put the 'End If' at the beginning of a line :P

  • (cs) in reply to Ray
    Ray:
    Frzr:
    int fancy_check(int *x, int *y) { if (*y==0 /* can't work with y=0 */ || *x/*y==*y /* can't work on squares */ || *x==3) /* I hate the number three */ return 0; else return 1; }

    int main(int argc, char *argv[]) { int x,y; x=0; y=1; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y)); x=9; y=3; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y)); return 0; }

    Color highlighting shows the mistake right away. Nice try. :)

    Color highlighting? You mean you actually had to paste that into an IDE before you could see it? :: giggles ::

  • SomeCoder (unregistered) in reply to Ray
    Ray:
    Frzr:
    int fancy_check(int *x, int *y) { if (*y==0 /* can't work with y=0 */ || *x/*y==*y /* can't work on squares */ || *x==3) /* I hate the number three */ return 0; else return 1; }

    int main(int argc, char *argv[]) { int x,y; x=0; y=1; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y)); x=9; y=3; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y)); return 0; }

    Color highlighting shows the mistake right away. Nice try. :)

    This is exactly why I it when people format their code that way. What is wrong with adding spaces in there:

    if (*x / *y)

    rather than

    if (*x/*y)

    which not only doesn't work but looks bad anyway.

    Oh well :)

  • (cs) in reply to aristos_achaion
    aristos_achaion:
    Personally, I don't get using VB, or Windows for that matter. But different strokes for different folks, I guess.
    As has often been pointed out here, and even by me in an earlier post in this thread, you don't always get to choose your OS or programming language. Especially in a town of population 85,000, where you will be lucky if there are a dozen programming positions in the whole town, nevermind you actually getting hired for one of them (which happens when somebody dies or moves away).
  • Americium (unregistered) in reply to T $
    T $:
    Raw:
    I've seen that problem happen occasionally in some older VB version (probably VB4, it was buggy as hell). I never managed to figure out the logic behind it, but it certainly did happen, and the solution was to put an empty Else clause.

    I can believe it. I'm curious though, would this mean that the compiler bounces back an error without it, the program would issue a runtime exception, or is it executing everything past the end if only if the condition is true.

    I just discovered a similar bug in Python. Prior to version 2.5, The finally block couldn't exist without an except (same as catch).

    try: f = open('./file.txt') # ... # Error in Py2.4- due to no except: finally: f.close()

    These are both parser design flaws. if without else and try without except are probably difficult cases. See the topic if-statement dangling-else on compilers.

Leave a comment on “Illogical Logic Flow”

Log In or post as a guest

Replying to comment #:

« Return to Article