"Some programmers like to program defensively," wrote Sam, "and then there's some of my coworkers. This is found at the top of nearly every function of our C++ classes."

if (!this) return false;


Jon Passki found this while debugging a certain vendor's security token management software.



Josh's predecessor seemed to miss out on the fundamentals the request/response paradigm.

// TODO: why does this function call accept 
//       a request and return a response?


"A long while back I submitted #define ZERO -1 from memory," writes Andy Goth. "Well, turns out that my recollection wasn't entirely accurate. I found the actual code and it was a even more surprising than I had remembered."

#define NEGATIVE_ONE 0


"I was going over some code from a SDK released by you know who," Tammie Kong wrote. "There were a few questionable things in it, but then I found a single line that made me pause. I realize string.format() has its advantages and all, but this just seemed ridiculous."

string query = String.Format(CultureInfo.InvariantCulture, 
      "SELECT uid1, uid2 FROM friend WHERE uid1=", 
      " AND uid2=", 


"You can guess my reaction when I came across this function," commented Mike B.. "Of course, the Real WTF is that it doesn't work for everyone using IE6, as it requires an additional [event.returnValue = false;]."

// Function to confirm before deletion
function Custom_Confirm(message)
    // Show confirmation message
    var confirmation = confirm(message);
    // If confirmed then return false to stop form submit
    if (!confirmation)
        return false;
        return true;


"While going through thousands of lines of code during refactor," Mila wrote, "I came across this interesting Java construct."

Boolean answer = new Boolean(
      ? new Boolean(true) 
      : new Boolean(false)).booleanValue();


"We had a strange problem wherein a procedure wasn't always returning the expected value," writes Jake T, "upon digging through the procedure's code, it was pretty apparent why."

RETURNS bigint
	RETURN 29654


[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!