- 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
Naturally, because Microsoft is well known for their horrible tools, non-existent IDEs, unpopular languages, lack of documentation and poor community support. Microsoft hates developers.
END SARCASM
Admin
I once worked with a compiler with a very odd bug - any program with a line count that was a multiple of 256 would not compile. Believe me, it took a while for us to figure out what was wrong - add a debugging line, and this would change the line count and the program would work fine. Remove it, and it would be back at the magic line count - no compile. Fix - counted lines and added a comment when needed.
Admin
Fix - get a new compiler...
Admin
Beeeep
You have reached the phone of God. God is unable to come to the phone right now - being busy dealing with complaints from The Meek who are irate at not having received their promised inheritance. Please leave a message after the extract from The Hallelujah Chorus.
Admin
For weird bugs in VB6 inbuilt functions have a look at this -
Dim val As Long
val = &HA5A5 'assign a UNSIGNED LONG value
val = 42405 'assign a signed LONG decimal value
Try single stepping (or adding your own output functions), note the numbers you get assigned to val.
For those who don't see it straight away you SHOULD get the SAME number each time, but you don't!
For those who think why use hex, well for that control application of always sending 32 bit values, and in this case the bit fields matched up in 4 bit fields to actual relays being switched it makes perfect sense for programme description matching hardware.
Note that VB6 on longs properly converts hex numbers &H0 to &H7FFF, and &H10000 to &HFFFFFFFF.
Admin
Admin
Gee Sponk.. They tried to understand it, even if they didn't figure it out and fixed it. Kind of like our new president.. Doesn't understand how it all works, but that won't stop him from fixing it... Dam da torpedos.. full steam ahead!!
Admin
and the programmers who sacked programmers who sacked programmers who sacked the programmers who wrote the vb code were.. sacked.
Admin
HA HA HA, poor bastards, they had a ref or something confused on their system with the Word VBA...
Been there....
Admin
I've said it a million times before.
B EGINNNERS A ll purpose S ymbolic I nstruction C ode
What more do you expect from beginners?
Admin
And hence the reason for the majority of the WTFs here.
Admin
Interestingly enough, I actually found (and reported and saw fixed) a bug in gcc's m68k optimizer of exactly this sort. The jmp portion of a conditional block was emitted incorrectly in a very particular case, which I encountered when I removed an else{nop()} block from my code, and bypassed by putting the else{nop()} back in.
(nop() was a one-line inlined function that produced an asm NOP instruction)
Admin
I once had this line of java fail to compile:
if(verifyData(sData)) plotChart(sData);
Error message? Missing semicolon. I copied the source to a new file in another project, and it compiled just fine. But for whatever reason, the main project thought it had a missing semicolon.
I cleaned the project, rebuilt from scratch, and still a missing semicolon. Closed the IDE, re-opened it, and still the missing semicolon.
I added the ornery source file to the other project, and now it wouldn't compile either, because of a missing semicolon.
So I opened the unworking source file in a hex editor, and the working one, and verified they were absolutely identical. :/
Could it be my OS? I rebooted the computer, but despite this, it still complained about a missing semicolon.
I tried deleting the file and creating a new one, but the new one with the same name also complained about a missing semicolon.
My solution? The program now has class DataChart2 rather than just DataChart.
I'm sure whoever inherits the program will wonder why the hell it's the only class with a 2 on the end. And when they read the comment "Needs 2 on end of classname to fix missing semicolon error.", it'll probably end up on TDWTF.
So maybe the interpreter was skipping that End If without the Else present. I'm hesitant to disregard this as programmer naiveté/error. After all, Basic interpreters are known for being rock solid. ;)
Admin
I know asking questions here is dangerous, but what mistake?
Yes, viewing this with a syntax highligher makes it look like there's a problem, but that's not with the code itself. gcc 4 compiles and runs this code on Linux and OS X no problem. As far as I can tell, I get the expected response with various parameters: 3,1 -> 0 1,0 -> 0 0,1 -> 1 9,3 -> 0
Does Visual C++ fail to compile this?
Admin
You know... When the bugs start biting.
Mike5
Admin
END SARCASM ^ END found without BEGIN
Admin
It always used to happen to me when there was an apostrophe at the beginning of the line....not sure why....
Admin
The first billy-goat....
Admin
For crying out loud. You write a long, detailed explanation of the program on tdwtf, and leave a mere hint in the comment? When I have to do something crazy like that, you'll get a long, detailed comment.
Now, if my (former) coworker found it, you got profanity.
Admin
It depends what you expect to be the response, I suppose...
I don't think th epoint was that it doesn't compile, more that it doesn't necessarily behave as expected.
Read the comments and consider those conditions, just because it works for some cases doesn't m,ean it works for all 3,1 -> 0 ... Fair enough, we don't like 3 1, 0 -> 0... Ok, can't work with y =0 0, 1 -> 1 ... Ok doesn't breach conditions 9, 3 -> 0 ... Rejected as a square, fair enough....
Let's try some other ones....
1, 2 -> 0....Hang on a minute.... 2, 2 -> 0 ...Hmmm...
Noone was suggesting it wouldn't compile, merely that it may not do what it was intended to....
[In Hindsight, I think I've been trolled]
Admin
Now it will give you an error because there are two semicolons... The original one is at the end of the comment.
Admin
The real WTF is that this is not a WTF at all, and most of you guys don't get it. :) It's a bug in VB. Very little real-world experience? How arrogant. I'd have written the same comment. At least they didn't write: This will not compile without the End If. WTF?!
Admin
At least the original programmer successfully identified that it was "Very Weird".
It would have been worse if he or she had simply accepted this as The Way Things Work and put empty else clauses on every if block in the codebase.
Admin
Admin
Depending upon what you mean, I may agree or disagree.
Once upon a time, I encountered a similar error in a C compiler. This was a production down situation, so I confirmed how to proceed with my supervisor, fixed it with a comment, and then came in the next Saturday, and futzed around with it until I found out what the actual compiler error was. Finally, I modified the logic so that it was unlikely a simple change would re-invoke the bug, documented the bug in the revision control log, put it through review, and rolled it into production three weeks later.
Do I qualify for your recommendation to get out of the industry?
Admin
That's not misleading THIS is misleading:
Admin
OK, I'll reveal what others seems to have found faster than I did.
A problem is in this line: || *x/*y==y / can't work on squares */ It looks as if it means: || (*x)/(*y) == (*y) but it really means: || (*x) because the /*y starts a comment. Yeah, it took me a second pass to see it.
Admin
I recall back in 1994 I was working with Visual C++ on NT. I encountered a source code file that had acquired an invisible control character; when opened in Visual C++, the whole OS would crash. It was quite impressive.
Had to open the file on a NeXT machine to find the problem and fix it.
Admin
Admin
VB3/4 had all kinds of weird buggy shit like that.
Admin
I used to always comment that weird buggy shit and I'm sure some arrogant younger asshole with a degree in "Software Engineering" came along and WTF'd years and years after the fact without any effing clue about the olden days.
Admin
I don't believe no one has pointed it out yet, but the tricky line, "*x/*y==y / can't work on squares */", will cause any decently set up C compiler to at least warn about a nested comment.
Admittingly, gcc seems to require a little prodding to display the warning (requiring -Wall). But then again, you are turning all warnings on, right?!
Admin
Try this one, I know it produces interesting results under gcc:
Without compiling, what result would you expect? What do you actually get?
Admin
Did I miss something?? (YES, I DID use gcc)
Admin
The line starting with /* is part of a single line comment, so is not interpreted as the start of a comment. Same with */.
Admin
gcc --version gcc (GCC) 3.3.2 Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
./a.out The value of x is 0
Must be the later version of gcc...mine is happy, happy But I see the point....
Admin
Oops....my bad....
Copy and Paste gave me blank line between each line.... Now I see it!!
Admin
Years ago, a coworker stumbled upon a similar problem in one of the Borland C++ compilers. There was an if statement that would only execute its block if there was an else block present. At the time, neither of us could tell by stepping through in the debugger what the hell was going on, so we just added a descriptive comment and went on slogging through our bug list.
I'm sure if somebody saw that code later, they probably thought we were clueless. I try to remember things like this when I'm tempted to poke fun at some WTF's.
Admin
So the WTF is that your IDE isn't showing the "x++" in a different color...?
Admin
Indeed, the real WTF is how come Alex never experienced a bug in compiler. The other wtf is the dangling else thing, i've been taught the else always matches to the closest then. As simple as that.
Admin
Actually counted lines or just wrote a quick script that does it for you and adds/removes empty comments at the end of each files as necessary?
Admin
I agree; I don't think that this is an error on the original programmer's part. I suspect a bug fix came along removed the problem. I have seen many problems with VB over the years that required similar workarounds. Around vb5 I probably hit two or three oddities like this. So kudos to the original programmer for leaving a good comment instead of an empty else statement.
Admin
Yes, so lets just sell it as commercial software, shall we???? AWFUL!!! In most companies I worked for this would have been a sackable offence!!!
Admin
Well they SHOULD understand it if they are working for a software company. Hacks and workarounds like that are part of what leads to security holes and exploits.
Admin
Admin
That just takes the concept of self-documenting code one step further: self-coding-documents!
Admin
Admin
I used to come across this one in Access 2.0 VBA:
If txtMyText Is Null Then DoSomething End If
This never worked as intended (do something when field is empty coz the bloody thing was either NULL or "". In case of "" the If was wrong. The solution was:
If NOT(txtMyText) Is Null Then Else DoSomething End If
Admin
Unfortunately, VB isn't mean enough to allow you doing this.
Admin