- 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
DON'T_DELETE_THIS_COMMENT_PER_BOB
Admin
#ifdef LAME_WTF
Admin
#ifdef COMMENT_MODE WTF?? #endif
Admin
#ifdef Brillant wtf!? #endif
Admin
#ifdef TOO_MUCH_STUPIDITY
Admin
#ifdef, you are lucky, not having to listen to more ifdefs.
Admin
#ifdef wtf!? Brillant #endif
Admin
#ifdef MY_HEAD_EXPLODED_WITH_DARK_FOREBODINGS_TOO
Admin
I'm puzzled by the numbers that precede the #ifdef's.
I can only assume that somebody has used grep (or similar) to extract all the #ifdef lines from some code and then sort and count. If so, why does "NOTDEFINED" appear twice?
I wonder what the Makefiles looked like?
Admin
Maybe it's the count per file, not per occurence.
Admin
While
is certainly mind-boggling, one important macro is clearly missing:Admin
#ifdef SPAM_FILTER_OFF post loads of links #endif
Admin
My favorite:
What happens if you leave this on? Does the system start going on and on about its colonoscopy or something?
Admin
Admin
Admin
Actually, it's
uniq
. Just used this yesterday :).Admin
#ifdef DO_NOT_USE
Admin
You must be one of those lusers who hasn't switched over to the uniqs operating system yet.
Admin
#ifdef OLDWAY
because you can't trust CVS to retain older versions of anything.
Admin
Next you'd think maybe not, because no other bug numbers appear in the list.
Top coders however will recognize TRWTF. There should be ifdefs for every bug number.
At my shop we use the ifdef bugno convention to comment out all buggy code. Then, a utility I wrote and only I truly understand combs through all the code looking for these ifdefs. I slurp up the lines of code inside the def into a massive hash. Then in a second pass I look for any recurrence of this known buggy code in any other locations. This guarantees that once a bug is identified, it will never be introduced again. Presto, no more regressions!
(Patent pending.)
Admin
'sort -u' to reduce pipes, though I'm pretty sure this is GNU-specific.
Admin
We're always joking about adding bits to our codebase that read '
', but... I mean... you just joke about stuff like that, right? Right?BTW, I hope Brut gets better soon.
Admin
#ifdef MORBIUS_DOESNT_UNDERSTAND_LOGIC
Admin
Admin
Knock, knock.
Knock, knock.
Knock, knock.
Knock, knock.
captcha: plaga - may one be heaped upon this comment
Admin
If those are from an sqr program, then they are actually very useful, even if the naming standard seems a bit inconsistent. If the values are defined elsewhere, then processing occurs based upon that definition.
Admin
...yes, how we did it in the 50s!
Admin
Ugh, the power of preview. This is what I meant to say:
1 #ifdef OLDWAY
Then it will also tell you how they did it in the fifties ;-)
Admin
Seeing that trailing space was a good spot, must clean my glasses. [Or was it a trailing TAB.]
I think the code may have been something like
grep "#ifdef" *.c | sort | uniq -c
Admin
At least they didn't use:
#ifndef NOT_DEFINED
or my head might have exploded.
Admin
Our application we littered with #ifdef OLD_CODE. Some people just don't trust source control.
One day we tried compiling it with OLD_CODE defined. Someone hypothesised that the resulting application might become self-aware, but actually it just printed a compiler error:
Admin
Admin
The archetypical command for this would be:
tokens in the pipes would be whitespace delimited, effectively skipping any 'trailing' whitespace. If anything, may be a difference between spacing on the left side, not right side.
captcha: ullamcorper Hmm, that's the realWTF
Admin
Can I use these names or are they copyrighted? Most of them are pretty good!
Admin
Top coders rock!
Admin
Me, I'm not so sure -- I'd be too afraid of what might happen if NOTDEFINED were ever defined.
Admin
Admin
Is this really a WTF?
First of all, these #ifdefs don't look like they are in a single file. It looks like the output from grep from a collection of files.
Second of all, surrounding code you wish to preserve but not delete with "#ifdef OBSOLETE" and "#endif // OBSOLETE" is a perfectly reasonable way of commenting something out.
Now, obviously, this type of code commenting should be removed at some point, but again, there is no indication that the files in question are in production.
I'm just sayin'.
bobr
Admin
Admin
Admin
What's wrong with just using "#if 0"?
Admin
Admin
We all know, that information has a critical value, which reached, will convert it to mass in a chain reaction, throwing us back to the Stone Age. Even Ijon Tichy knew about it.
Admin
I was surprised not to see
#ifndef NEEDS_MORE_COWBELL
Admin
And you'd be doing yourself and everyone else a disservice if you didn't ifdef the hell out of this WTF
Admin
Well, defining lowercase old might be a WTF too.
Admin
I would think it would be more appropriate as #ifdef PAULA_BEAN #define PAULA_BEAN IS_BRILLANT #endif
And if you think that's TRWTF, you must not be thinking of it the way PB would likely have done things...
As for debugging, sorry, I haven't had several months to debug...
Admin
'sort -u' is handy, but it doesn't give you the counts... The only way I know of to get the counts is 'sort | uniq -c' (or if you're like me, and want the list ordered by frequency 'sort | uniq -c | sort -nr' is what you're after.)
There's no concept of delimited tokens in pipes, only in the printing/reading programs - find, grep, sort and uniq delimit records with newlines by default, while xargs delimits records by whitespace. (Sort also has a concept of fields within records, which it delimits by blank-to-non-blank transitions by default.)
If something was delimited by whitespace, then no whitespace anywhere on the line would be seen, whether on the left or the right. (With the possible exception of field delimiters at the start/end of the record.)
As previously pointed out, the most likely occurance is two lines of the form:
and or which look the same to the reader, but are different as far as sort and uniq are concerned.Addendum (2008-12-10 18:12): Re: record separators: see also find -print0, xargs -0, grep -Z, sort -z and uniq -z, which make the record separator for each a null byte. (Less ambiguous in ASCII text which might contain embedded whitespace/newlines within records.)
Admin
Guys, I'm 100% serious here -- this is indicative of a huge WTF, and I beg you to heed what I say.
Given, lots of these look like ways to comment-out/remove code blocks; not awful, just sloppy that it didn't get cleaned up.
But look at these: 1 #ifdef BUG92283 3 #ifdef DIRECTIO_ON 1 #ifdef HAS_NAMESPACES 1 #ifdef REAL_DELETE 1 #ifdef SLEEP_DOESNT_WORK 5 #ifdef USE_QUANTIFY 7 #ifdef USE_STDIO_FILE 1 #ifdef USE_TIME 1 #ifdef UTIL_GLOBAL
That's 9 variations (that we know of!). If you make a change, you should test 2^9 variations and make sure they all work.
Folks, this way lies madness. ONLY allow #ifdefs for:
Admin
I'm assuming most of those conditionals are used to comment code out. The usual convention is:
#if 0 /* explanation of why it's disabled */
#endif
but #ifdef SOME_TOKEN_NOT_DEFINED achieves the same thing. Hence you wouldn't expect to see it in the Makefiles at all.
It's redundant if you have and use version control, but plenty of people in non-preprocessed languages comment out blocks.