- 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
There's a perfectly good explanation for this: bool was NIH.
Frist?
Admin
Cue the YesNoFileNotFound permutations.
Admin
substract 1 and take the absolute. then suddenly the values are the right way round
Admin
Man! What were they thinking ?
Admin
haha..."Do you think your enumeration is sane?" NOT!
Admin
Was this coded by someone who believed that when she says 'No!' that it really means 'Yes!'?
Admin
It sounds as if the person who wrote that perhaps spoke English as a second language. For native English speakers the instinctive opposite of "Yes" is "No", but others may easily make the mistake, especially if their native language isn't closely equivalent. For example, I'm horrible at remembering the genders of German nouns.
Working at an e-commerce company that farms a little bit of the dev work out to India, I see things like this occasionally. Once I saw a variable "boolean allowGiftWrape".
Admin
Hey, why the link in the first reply go to yahoo to get to wikipedia?
Admin
It's opposite day!
Admin
Two things immediately leapt to my mind when I read about the debugger:
In the Bourne shell, an exit code of 0 indicates success, and any other indicates an error. Sensibly, the boolean logic of the shell uses 0 as true and any other value as false.
The fact that your debugger displays the enum values as numbers, thus making it hard for you to understand what they mean, is the fault of the debugger, or perhaps the programming language; not of the programmer who wrote the program.
The code is still insane, though.
Admin
i still like BoolPlus best:
Yes, No, Perhaps
Admin
Only if the question is, "was it successful?" and not "what's the error code?"
Perhaps it isn't compiled with symbols for whatever reason.
Admin
I noticed that Google does that too, when you search for something and hover over an url it shows the normal one, but when you copy it it has all this google crap before it.
Admin
Because I copied the link from the Yahoo results page. Didn't consider the stupid redirect, sorry. This is the correct link.
Admin
They should just change the order of enums. For any well written application it should have absolutely no effect...
Admin
Yes means No and Not means Yes. Does this code suck?
Admin
Admin
Admin
Here (in Germany, at University) i maintain an application that has database fields "firstname" and "sirname". Maybe a simple typo, but could be a lack of understanding also.
Admin
Yes, it is.
Admin
No it isn't. Now who's telling the truth, me or Mikoangelo?
Admin
Admin
Yes, as a non-native speaker of English, I often misplace my W's too.
Admin
Some id10t did the same thing in one of our apps. It's still there, complete with a comment by a frustrated subsequent developer:
Admin
Before I saw that it was C++, I thought maybe 'no' was a keyword.
Like you've never had to use 'klass' instead of class, or 'type_' instead of type.
Admin
Borat: This Yes is NOT 0.
captcha: NOT!
Admin
yeah, along the way you could also multiply with 100 and divide with the square of 10 ... or just subtract the int value from 1
Admin
Mikoangelo, if I remember my logic puzzles correctly...
Admin
Oops, I don't remember it correctly. The puzzle I'm thinking of has a different solution (T$, if I asked Mikoangelo myself, would he say it's opposite day?).
In any case, Simon is clearly lying. ;-)
Admin
http://mathforum.org/dr.math/faq/faq.liar.html
Admin
That enum is SO missing a "Brillant" entry.
Anyway, the enum writer was probably a fan of Waynes World. Which probably tells us the age of the code (or the author).
Captcha: "quake". Now where did I put that CD?
Admin
Yes that code is a horrendous WTF.
The only bigger WTF is that it wasn't immediately refactored the first time someone with a clue saw it.
Admin
So... anything that is not Yes is TRUE and therefor No, which is the opposite of FALSE, which in turn is Yes?
At least the triple negation works... sorta.
Admin
or.. i = (1-i)
Admin
Yes, that is false. That is not false.
What's so hard about it?
Especially once you understand these are allowed answers to the following question: "Is it false to say that the value isn't true?"
--Rank
Admin
Admin
You're lying if you say it's Opposite Day. You can only say It's NOT Opposite Day!
Admin
Or just subtract from 1 and forget the absolute. :-)
Admin
I don't agree with the code, but if they just were enums to a push button response, and they matched the proper one to the proper event, no one would ever know.
Admin
This suit is black! Not!
Admin
Much easier and even more confusing if you subtract from 1:
Admin
I was going to suggest the same, but let's use the enumeration values, shall we?
Not - Not => Yes. Not - Yes => Not.
Does that mean two wrongs make a right? Hmm...
Not + Not => 2
Guess naught.
Admin
The WTF is that you're using magic numbers to test the result. You have to remember the inverted logic every time you use it. Chances are you're gonna screw up at least once and it'll cause problems. Defining it as an enum like the original WTF actually makes more sense.
Admin
Admin
Admin
Perhaps as a response to the question "Is it false that you want to download or not"?
enum TypeDlYesNo { Yes, Not };
Admin
I'll have what that enum is having.
Admin
I'm sure either of us would have been happy to try to rewrite the application to switch yes=0, no=1 for yes=1,no=0. But that was not our assignment, and so we were doomed--he to leave a disparaging comment in the code, and me to post it on TheDailyWTF (that's still how I think of this website, and what my coffeecup still says).
Admin
Admin
Or just subtract from 1