- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
DO NOT REMOVE THIS COMMENT! The Daily WTF is skipping the Real WTF without it. Very weird.
Admin
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.
Admin
Maybe it was because of... things.
Admin
'******************************************************* '***** DO NOT REMOVE THE APOSTROPHE AND STARS ***** '***** Program will not compile without them ***** '***** Very weird. ***** '*******************************************************
Edit: Fail :(
Admin
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.
Admin
Admin
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:
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).
Admin
I think I just found my new programming style.
Admin
Admin
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.
Admin
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.
Admin
Well, in most workplaces, you really don't get the option to pick your favourite language.
Now, that's why you use an editor which color-codes the code, and set it to display comments with another background color.
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.
Unless you have a way overdue deadline. Then you just ship it and check it out later.
Admin
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; }
Admin
How often does checking it out later actually happen?
Admin
Have a look at the principles of job-extension methodology: "How to Write Unmaintainable Code,"
http://freeworld.thc.org/root/phun/unmaintain.html
Admin
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.
Admin
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.
Admin
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".
Admin
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.
Admin
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.
Admin
Admin
Admin
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
Admin
Addendum (2009-06-01 10:27): Oops... my mistake; sorry. Note to self: read more carefully next time.
Admin
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.
Admin
Literate programming?
ducks
Admin
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.
Admin
Admin
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."
Admin
As expected, this is a comment as expected.
Admin
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
Admin
Admin
Admin
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.
Admin
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 =)
Admin
Color highlighting shows the mistake right away. Nice try. :)
Admin
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.
Admin
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.
Admin
np: The Wooden Birds - False Alarm (Magnolia)
Admin
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.
Admin
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. :)
Admin
Fixed.
Admin
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.
Admin
You shouldn't fix what is not broken :)
Admin
"I swear to God, if you sabotage any more code, I will start the disciplinary process!!!"
Admin
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
Admin
Admin
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 :)
Admin
Admin
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.