- 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
No doubt return_true_24() not only returns true, it aborts if it thinks that you're a terrorist seeking to take control of the US government.
Admin
What's wrong with this?
I write functions all the time that return true.
captcha: tps mmmmmmmmm yeaaaaaaaaaaaah
Admin
Of course it makes perfect sense. You need a family of functions to reflect varying degrees of 'truthiness'.
Admin
So, what's new?
Admin
I call dibs on writing the <font face="COURIER">return_true_42()</font> function.
ok
dpm
Admin
I'd be fascinated to see some examples -- ideally, three or more. Given the function's only purpose is to return a boolean value, I wonder what "slightly different" actions it could be performing... Some nasty side-effects, perhaps? Or maybe the code contains "#define bool int"?
Admin
:-)
return (bool) ( return_true_6() * return_true_9() );
Admin
The WTF for me is the Symantec add in the RSS feed that says 'Enterprise security software that gets to threats before they get to you'.
Two things:
wtFFtw
captcha: awesomeness
Admin
(I hope you're joking) There's a differance between a function with a meaningful name that returns true, and a function whose stated purpose is to return true, and yet might not. One should give such a function a meaningful name so that maintainers will know what's really happening in the function:
//Note: WTF's are intentionally preserved: Feel free to count them.
bool return_true88()
{
if(return_true12() && return_true5()) return true;
else if(return_true19())
{
FILE* junk = fopen("config.txt", "r");
char tmp[256];
fread(tmp, 1, 256, junk);
it(tmp[0] == 'a') return true;
}
return false;
}
As you can see, you really don't know what's happening in 12, 5, and 19. All you know is that 88 tends to open a file, forget to close it, and contains no error checking. imagine if these had meaningful names, like CheckRegistry, CheckCommandVars, and ConfigExists.
Admin
Proof positive that all maintenance programmers (like myself) are suckers.
Captcha = awesomeness. I wish.
Admin
Perhaps you meant return_true_6() * return_true_<font size="+1">7</font>(), or was that an intentional wtf?
Admin
This Anonymous fails in a most spectacular way. Congratulations in showing your literary ignorance :P.
Admin
(rampant speculation)
maybe the function looked like this:
bool return_true_24()
{
static int truthiness = 24;
return (truthiness) ? (truthiness-- != 0) : false;
}
Admin
The number 42 refers to The Answer to The Ultimate Question of Life, The Universe, and Everything from The Hitchhiker's Guide to the Galaxy by Douglas Adams. The ultimate question turned out to be 'what is six times nine', also from Adams' series.
So... intentional, but not a WTF.
Admin
Nope. Yours is the WTF for now knowing The Hitchhikers Guide Trilogy lore.
Admin
6*7 = 42 if you use a tridecimal system.
Admin
and oddly enough, 6 * 9 = 42 in base 13.
Captcha: knowhutimean No, I don't think I do.
Admin
actually, that should be "6*9" instead of "6*7".
Admin
"I may be a pretty sad person, but I don't make jokes in base 13."
--Douglas Adams
Admin
The only circumstances under which i would write a function like this is if i were writing a proc/function who's implementation has yet to be completed *and* i wish to test the rest of the system in isolation.
This sort of thing should, of course, be FIXME'd to death! and never reach test, let alone live!
The WTF is that there are coders out there that do this!!! Mind you don't trip over your spurs boys!!!
Admin
Which is why I said 'oddly enough'...
Admin
it doesnt get better than this.... truly a "Representative Line" :D
Admin
The real WTF is that this article has turned into nothing but a pedantic HHGTTG festival....
Admin
>The *real* WTF is that this article has turned into nothing but a pedantic HHGTTG festival....
agreed! lets have some *real* WTFs please!
Admin
I once quoted "Resistance is useless!" and was chided "Resistance is FUTILE! Get it right!". Evidently I was in the middle of a pendantic something else festival.
Admin
Seems to me as if these functions were actually reverse-engineered from somewhere. That's how you get to names like these. That, or a massive amount of scripted program transformation...
Admin
The ultimate WTF method declaration we had at my last place from one of our Senior Software Developers was a method in java declared as:
public List fetchSameButDifferent(List other);
I can't remember what it did (or tried to do), but I will never forget that name...
Admin
The REAL WTF is that they don't start numbering from zero!
*ba dum bum pish*
Admin
Resistance is Volts over Amperes.
Admin
Heh. That's clever. Thanks for sharing. :)
Captcha: 1337
Admin
But how do you know that the question isn't 6 x 7? The computer that was calculating the great question (Earth) was compromised by the addition of the Golgafrinchams 2 million years before readout. Therefore the question was tainted - 6 x 9 = 42. The question was supposed to be calculated by the humans descended from the cavemen, not the telephone sanitisers.
We don't know (and neither did DNA) what the true question was.
Admin
was beat to it....
Admin
The "real WTF" is that it isn't consolidated into one function:
Hmmm after rereading this I think I should have added explicit sarcasm tags. Or are they implied for all posts on TDWTF?
Admin
Thanks for the link...I never read an analysis of a C program in Italian before.
Admin
<wtf/>
what about:
public int GetInt()
{
int
}
Admin
<wtf/>
what about:
public int GetInt()
{
int nValue
Admin
<wtf/>
what about:
public int GetInt()
{
int nValue
=Admin
<wtf/>
what about:
public int GetInt()
{
int nValue
Admin
<wtf/>
what about:
public int GetInt()
{
int nValue =
Admin
<wtf/>
what about:
public int GetInt()
{
int nValue = 0;
return nValue;
}
and then having all of your developers use GetInt when they need an local variable.
Admin
AAAAAAAAAAAAAAAAAA sorry people
Admin
I prefer:
if ( (bool) ( return_true_6() * return_true_9() ) == TRUE)
return TRUE;
else
return FALSE;
Admin
I hope you corrected the misguided pedant. The correct line is indeed "Resistance is useless!", as can be heard on track 16 of the CD edition. Oh, and for more information on this vital subject, please refer to this article.
:-)
Admin
the TRUE wtf is that it's not a tri-state! Bheh.... I was going to write something about how I want to wrap my hands around the whole dev team's necks including the project managers, but bleck... I've accepted the fact that craptastic shit like this is an everyday occurance. I only hope that I'm never on such a team...
Admin
Being pedantic about HGttG is entirely fun -- especially since I've been re-reading the series recently -- so I'm gonna go ahead and be pedantic and say:
"Yeah, um, we never actually find out what the ultimate question is in the book, that part where Arthur pulls letters out of a hat is just a joke. Arthur got it, you should too. Also, the correct quote is 'what do you get when you multiply six by nine'."
Ok, I'm done. :D
Admin
bool return_true_24()
{
return Convert.ToBoolean("They have my daughter".ToString());
}
Admin
Agreed. DNA expanded the joke to actually make more sense in the book version, where Ford notes that it's probably the wrong question, or a variation on the right one (before they pull out the letters). Having it turn out to be a variation on the wrong one was the humorous bit, which most people miss anyway.
In the radio series it is much less clear, I grant you. The gag there is more along the lines of it indeed being the correct question, it simply turns out that the universe itself was wrong.
Admin
Hmmm... could that code be the result decompiling a non-debug build?
I ask because I've seen *production* code in use before that was "lost" and recovered by decompiling the binary that resulted from the last successful non-debug compilation. Why it wasn't just recovered from source control is a whole other WTF-worthy story.
Anyway, the code in question included very nonsensical variable and function names, I remember a few specifically that had been named by the last line in the function
Admin
Admin
I whole-heartedly agree with you. How do I sign up for your newsletter?