Saw this today in C#:
// x is some random string
if (x != null || !"".Equals(x))
...
That rules.
Second place goes to:
for(int x=0; x < y; x = ((x) + (1)))
...
-
-
You forgot to Set Sarcasm = On, so for a little bit there, I thought you were out of your mind.
-
Stop picking at my code! uhh opps [Runs Away]
-
wonderful examples
life is that complex ... -
These are worthy of submission to http://thedailywtf.com
If you haven't checked this site out, you definitely need to
-
I've seen people do a good deal of weird stuff, two of my favorites:
int i; i^=i; // optimization, makes i = 0, but faster.
char str[32];
strcpy(str, "foo");
strcat(str, "\0"); // set null terminator
-
the first is sane in assembler( xor eax, eax is a fairly standard pattern ), but any optimizing compiler would generate this from int i=0 anyway.
One i saw recently was
// loop forever
for( unsigned __int64 i = 1; i !=0; i++ )
{
// do something that takes about 1/100 sec.
}
kind of hard to argue that it'll ever finish but... -
spod wrote:
// loop forever
for( unsigned __int64 i = 1; i !=0; i++ )
{
// do something that takes about 1/100 sec.
}
kind of hard to argue that it'll ever finish but...
Won't it finish when it overflows?
-
Rossj wrote:

spod wrote:
// loop forever
for( unsigned __int64 i = 1; i !=0; i++ )
{
// do something that takes about 1/100 sec.
}
kind of hard to argue that it'll ever finish but...
Won't it finish when it overflows?
Yes, in about (UNSIGNED_INT_64_MAX / 100) seconds - a little under six billion years.
-
1 1#9;
Or for an infinite loop, do:
1 1
Fun! It's some silly language called Whenever. It executes code in whatever order, at random times. Hope I'm not too off-topic, but I could hardly resist.
-
Another stupid programming language: Intercal.
Statements must begin with DO, PLEASE or PLEASE DO. If you don't use PLEASE often enough, the compiler thinks you're rude and won't compile your program. If you use PLEASE too often, the compiler thinks you're sucking up to it, and won't compile your program.
-
what about COW...that has to be my favorite...and its turing complete...
http://www.bigzaphod.org/cow/
here's some sample COW from the site to generate the fibonacci series
MoO moO MoO mOo [[ main loop ]] MOO [[ print first number ]] OOM [[ temp copy of first number ]] MMM moO moO MMM mOo mOo [[ store second number off in the first position now ]] moO MMM mOo MMM [[ move back to temp number ]] moO moO [[ use temp to add to first and store in second in loop ]] MOO MOo mOo MoO moO moo mOo mOo moo
-
I like Ook!, personally
EDIT: fibonacci generator in Ook!
Ook# .Net -
Oh please, the only sensible language in todays busy environment is Whitespace http://compsoc.dur.ac.uk/whitespace/index.php

-
YOu could be onto something here. You've read Bjarne Stroustup's plans for C++ 2000 in this area, right?
http://www.research.att.com/~bs/whitespace98.pdf -
if(function_exists('disfunction')){
settype($i,'genius');
}
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.