Tuesday, October 24, 2006

Funny Code

What is the funniest line of code you ever saw? One of the developers at Barcap wrote the following: line in a C# function

if (this == null)
{
}

It absolutely cracked me up (well... I guess you had to be there).


©2006 Marc Adler - All Rights Reserved

3 comments:

Anonymous said...

Actually looks a bit familiar. If there was some code in the block I'd guess it was used to fix a debug breakpoint that the optimizer couldnt eliminate. I used to do things like that in the early days of C programming.

i.e.

if (this == null) // set break here
{
this = null; // never called
}


-craig

marc said...

Believe me ... it had nothing to do with anything that required thought ...

Anonymous said...

So what does the Unit test look like for this bit of nasty code ????????