- 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
Second!
Admin
Frist!
And not spam!
Admin
Not Frist1
Admin
Ahh, I see, problem was too much variation. FTFY
Admin
Shame we can't hire people for their comedy value any more.
Admin
enum{ fourth }
Admin
I'm very sorry he got burned before. It's a crying shame that he didn't get incinerated.
Admin
Sounds like a moderately-intelligent comlexifier. http://jamescreasman.com/2007/10/the-smart-complexifier/
Admin
If the compiler handles the literals incorrectly, then how can he be sure that they're handled correctly when being used as the value of an enum?
Admin
I wonder if now the compiler will get "Tweleve" right...
Admin
Oops - a big guffaw across a quiet office!
Admin
I was under the impression that 20, 23, 60, 250, 255, 500 etc. were literals too. Must be mistaken because compilers get literal numbers wrong!
Admin
Admin
Man, get a life. Seriously.
Admin
What're the odds he got "burned" when he used a literal 010 to mean ten?
Admin
... or something like this did not compile: int x = 019;
Admin
"I've seen compilers get literal numbers wrong before"
The next time I eff up and introduce a bug I am totally using this.
Admin
If I was in a mischievous mood, I would like to make the following change:
Zero = -1,
...and watch the resulting mayhem.
Admin
Reminds me of the time a colleague got bitten by a C compiler's interpretation of some literal numbers he put in some source code.
The year was 1991, maybe 1992. It was an embedded system (without any file system, no less) with a four-line, twenty column text-mode LCD display.
The data to be displayed was separated into numbered pages. Page numbers were four digits, divided into section, chapter and page-in-chapter. Being software types, we naturally started at zero, which lead to a hysterical issue with the page number validation routine. You see, a large fraction of the pages numbered between 0007 and 1000 (exclusive) were declared invalid. The reason: my colleague's nicely laid out table of valid page numbers, stored in 16-bit ints, completely formatted with leading zeroes and all so they'd look like the numbers you typed on the keypad. There was no page "0xx8", so the compiler didn't crap out, but the octaliser guaranteed that not one of the numbers was interpreted the way that he thought.
The real WTF here, however, was me. It took me three passes over the code before I noticed the leading zeroes. In his defence: as soon as I said, "They're octal," he did a facepalm and went to fix it.
Admin
I'm new to this site, but this is the first one I've seen so far that had my mouth gaping while I read it.
Admin
I wonder if he uses a compiler he wrote.
Admin
Got burned enough on leading zeros that every color capable IDE or editor I use, mark octal in a different color from decimal or hex.
Admin
All he needed was:
enum Numbers { forty_two = 42; }
Admin
Hopefully, this is a 16 bit system. Either way declaring MaxValue is a WTF of its own.
Captcha: facilisi. Enums are not the right facilisi.
Admin
He is a witch! I say we need to burn him and his code at the stake.
Admin
Seriously, never let this guy touch code again. Using an enum this way is dumb. Really dumb.
Admin
I have really missed a trick - in all these years it's never occurred to me that underscore plus number is a valid identifier.
Admin
I admit I appreciate his strategy: rather than "get burned" like last time, he chooses to burn everyone else. That's just being a team-player.
Admin
He strikes me as a guy who (like many of us) got hit by octal values one day during his beginner days. Hahaha they joy of getting compile errors or wrong values after using [08] to align some array filling code.
Unfortunately for him, unlike what anyone with decency would do, he assumed it was yet another compiler bug that was burning him. Instead of learning about octal values. Oh well.
Admin
Admin
I have to say, I don't care much for these CodeSOD articles. I don't have much opportunity in these articles to put my unique technical/business acumen on display.
Admin
The number 23! It's everywhere!
Admin
I refuse to believe someone can be this stupid. Seriously. That's just freaking awful. I would take one look at this code and fire him. immediately.
Admin
Admin
The irony is he's getting burned by everyone on this site.
Admin
I haven't used ^G but I would say that once you figure out the sticky bit in the /tmp directory, you are one step on your way to losing your liking for ACLs.
Octal values are easy to remember because you can say them out loud. Do you remember the pronunciation? It is from the scifi novel with the city in a shield, and et the cetera. Phooey. Captcha = nibh.
Admin
Admin
enum {
One = 1, Two = 2, Three = 3, Uh = 4, My_baby_dont_mess_around = 5, Because_she_loves_me_so= 6 And_this_I_know_for_shooo= 7, Heyyyyy_yaaaaa = 8 };
Admin
So does he have an enum for all the possible calculations from his enum?
enum { ZeroPlusOne, OnePlusOne, TwoPlusOne, ... }
yknow cause the compiler could burn you that way too...sneaky compilers!
Admin
Yeah, that's what probably burned the Bloviator. One of those gotchas in C, like opening files in binary vs. text, missing a break in a switch statement, nested if-then-else not behaving as expected, operator precedence, = vs ==, printf format string mismatch, the unholy strtok (useless, should be banished), the evil gets (now banished), etc.! No doubt, C is a brutal language, just one step above assembler.
Admin
This is a clear case where a Software Engineer IV needs to be busted back to Software Engineer I, until he learns how to use enums correctly. Hint: Depending on their numeric values isn't very smart.
People who do this crap wouldn't recognize a #define if it bit them on the ass.
Admin
Technically, in C and C++, any identifier with a leading underscore is reserved. In practice they usually work, until they don't.
You run into that a lot in C/C++, where something is outside the standard but in common usage and then people start whining when a new version of a compiler starts rejecting their code.
Admin
Correction:
Admin
Burned by octal, never forgotten. This guy carries long grudges
Admin
enum Numbers { forty_two = how_many_roads_must_a_man_walk_down }
Admin
Admin
Admin
Another keyboard, you owe me one.
Admin
Wierdly enough, a major C++ compiler I have worked with has/had an obscure bug that would in very rare circumstances duplicate a character. I think it was an off by one bug in the lexical analyzer. So my source might contain the line:
int var2 = var1;
and the compiler would be treating it as
int var2 = vaar1;
I would "solve" the compiler error by putting a long comment on the line before, to shift the error into the comment.
It was a worry that the bug might occur someplace that didn't break the source code. I can easily imagine "x = 1;" getting turned into "x = 11;".
It was a pretty rare bug, though, and only seemed to occur in source files that were so long they were inherently WTFs.
Admin