- 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
Wow. I have seen error handlers doing things like
but that’s definitely one level higher. Must be fun for maintenance, too. “Add a confirmation dialog here? OK, that will take one or two weeks…”
Admin
I wonder who is going to be the frist person to comment that the real WTF is the use of VB?
Admin
fri- ah fuck, every damn time
Admin
I liked before you guys posted~
Filed under: Wer reitet so spät durch Nacht und Wind?
Admin
Admin
All the fun of keeping track of addresses, without the assembler.
Admin
Got to the line with OR ERL=... and the realisation of horror hit me suddenly, just like a slowly-dawning realisation of horror, except quicker.
Admin
Remy, thank you for a write-up which presents the WTF clearly and presents the additional material as a link for those who want to follow it. This article has my nomination for the best-of-2014 shortlist.
Admin
In seinen Armen der Code war tot.
Admin
[quote=dbenzhuser] In seinen
ArmenZeilen der Code war tot. [/quote] FTFYFiled Under: 49,46,44,244,39.... clearly the Illuminati are at work here!
Admin
I once had to write vb in a country local version of Office where all the vb-syntax had been converted to Norwegian.. With no reference manual.. It took me two hours to figure out the name of the rand() function!
Admin
That's an impressively serious level of fail even by VB6 standards. And
On Error Resume...
is failtastic before you start.I have written VB6. I have never written VB6 that badly. Not even on my first day with the language.
Still it could be worse. It could be my stepdad who steadfastly continues to use QBASIC. GO SUB everywhere. Labels. Not even DEF SUB or DEF FUNCTION to make sense of the code. Everything's global as a result. Using DEF SUB is 'too complicated'.
Admin
The only thing that can be said in mitigation is that at least the error-line is displayed in the message box so you can fix it. (Well, assuming you can work out which existing Erlvalue needs to be fixed...)
But it is only mitigation, not absolution. The original coder is still ARWTF. (There are plenty of other RWTFs, so he is only A RWTF.)
Admin
I see nothing wrong here. The original programmer obviously knew the code was perfect and never ever had to be changed and therefore could safely rely on line numbers. The RWTF was of course Ryan forcing a change in that masterpiece.
Admin
Visual Basic doesn't actually put line numbers in unless you tell it to, and in fact the numbers don't have any meaning other than the Erl() function. So if you have something like
Sub blah doSomething 1 doSomeOtherThing End Sub
and add a call to doYourMother in the middle, the doSomeOtherThing line will still be line 1 and still work exactly the same.
Sorry. Someone had to be the killjoy.
Admin
Erl doesn't show the line number that most of us are familiar with. It shows the BASIC line number, not the position of the error within the source code. See [this example][1]. So, in order for this WTF to have actually happened, several things would have had to have happened:
Regardless of how screwed up VB6's error handling is, the original coder's line numbering is a bigger WTF, and Ryan's WTF is even bigger. [1]: http://msdn.microsoft.com/en-us/library/97sx19w1%28v=vs.90%29.aspx
Admin
Good thing VB added exception handling fifteen years ago.
Admin
The problem with most VB programs with On Error Resume Next is that the programmer never bothers to check if there really was an error.
Admin
I didn't see exceptions in VB, but then again I was doing it about that many years ago with VB5 at home and VB6 at school, and I gave it up shortly after that when I realised I didn't want to be writing desktop apps.
I didn't discover exceptions until much later, sadly.
Admin
That makes it a programmer WTF, not a VB6 WTF.
Admin
Ryan's fix can not be characterized as "adding a single line of code", since he obviously did some sort of RENUMber operation.
Admin
I inherited a 25,000 line VB6 application and a bunch of smaller ones back in 2006 and I had to deal with the question "How do I get decent error messages out of this thing?". About the only viable option was to run the source code through a preprocessor that added line numbers before compiling so that Erl actually worked. This was especially fun since there are a number of places that line numbers can't be put, so the preprocessor had to parse the VB code in order to avoid introducing errors.
Fortunately, in less than two years, we moved the code to .Net and had a manageable error handling syntax.
For added fun, a lot of the smaller VB6 programs were run as services. They were just regular forms-based desktop applications with a timer control that were run as a service with SRVANY. Man did that suck.
Admin
If the programmer is willing to use a language that requires you to check for errors after every call, like C or VB, then yes, it's his fault.
Admin
Here I was thinking it was the loopctr wasn't being initialized properly and at some point initialized over 100.
Admin
Guys, we still need the Front Page Troll badge!
Also, what happened to the cornify script?
The evil ideas thread is :arrows_counterclockwise: :arrow_right: :arrow_left: over there.
Admin
In that case TRWTF is still VB6 for having a discrete numbering scheme.
Admin
The WTF is the programmer that numbered his lines. The bit you quoted is from my list of WTFs, not a list of good ideas. VB only supports line numbers for backwards compatibility with pre-VB BASIC; anyone who used them is a retard.
Contrast this with JavaScript's Automatic Semicolon Insertion. When you encounter an ASI bug, it's because the feature bit you in the ass by its very existence. You don't have to intentionally use ASI to be bit by ASI. At least VB6 allowed you to simply not number your lines and you could pretend the feature wasn't there.
Admin
yeah, but... VB macros in Excel sure depend on the user not only leaving cell positions alone, but not even hide/unhiding rows or columns. Otherwise, similar fail.
Admin
Oh, Remy...
Admin
Talk about Shades of the COME FROM Statement...
Probably the worst thing was he obviously didn't even use the statement labels.
Admin
Yeah, exceptions didn't come around until VB .NET
In my experience, that's not the case.
Admin
Right? Especially on an article called "King of the Faeries"? I guess he really wanted to cornify "Erl-King" but wanted to link it even more.
On the other hand, they're rather different kinds of fairies. On the other other hand, maybe the Cornify unicorns are sinister too. AFAIK no one has ever survived a unicorn attack...
Admin
Here's something to think about: C has no error handling syntax. All it has is a convention that return values will be used to convey the status of the operation back to the caller. On Error Goto is arguably worse than C-style error handling, which means this syntax is worse than no syntax at all.
Admin
[spoiler]Remy doesn't usually cornify CodeSOD articles.[/spoiler] No idea why.
Admin
Huh. I thought we just needed the < fe> markup < /fe>
Admin
Literally, in my company's code base:
if (!e.Message.Equals("Thread was being aborted."))
Admin
@CodingHorrorBot
Admin
Obligatory Der Erlkönig German Lieder by the late and great William Warfield and Sylvia Olden Lee, IMO one of the best recitals of the song in the post war era. https://www.youtube.com/watch?v=aapUdJSvf0M
Translation: http://german.about.com/library/blerlking.htm
Admin
From the linked wiki page: http://en.wikipedia.org/wiki/Erlking#The_Erlking.27s_Daughter
Looks like The President's Daughter has a rival
Admin
@chubertdev Is Doing It Wrong™<t3220p36>
Admin
There's something wrong with this article.
Where are the unicorns?
Admin
I think this deserves more than a simple "like." Thank you for posting that. I haven't watched it yet (bookmarked for later, after work), but "Der Erlkönig" was the first thing I thought of when I saw the article title.
Admin
I somehow think she'd probably get her rear end kicked from here to next week by the (half-)elf maidens I know...
*cues horrific stabby fight scene*
EDIT: *summons @accalia and @presidentsdaughter*
Admin
I don't actually know any elf maidens, but I definitely got the impression from reading about them that they are a lot less nice than @presidentsdaughter.
Admin
an old Basic game i messed with came to mind: "sink the ship". a simple game where you had an airplane with 10 bombs, and you dropped them to try to sink a ship. you scored 1 point for hitting the lower deck, 2 points for the upper deck, and 3 points for a perfect bomb down the smokestack! just for fun, i decided to make a modified version that would also give you an extra bomb for a smokestack hit. BUT when i scored over 30 points, the game crashed! why? because the game used a "goto line (sc*100)" function to decide what message to display at the end of a game! (sc being the score)