Some programmers never learn. The following illustration depicts a delightful beach on a Caribbean island, a few seconds after the following line of code was executed:
return strcpy(malloc(strlen(s)), s);
This next one was a bit unfortunate. At a reunion of old army colleagues, one of our customers decided to show off his company's computing power by writing a program to organize the seating plan for the full-dress-uniform dinner to be held that evening.
unsigned charwhen he wrote
ch = toupper(ch);Still, on this occasion he didn't survive the experience, so this doesn't count as a repetitive fault.
This is one of our favourites. The value of
NULL on a DeathStation 9000 varies
from one compile to the next. It might be all-bits-zero and it might not. So this code:
memset(&weapon, 0, sizeof weapon); wasn't quite as robust as it might have been, as
a result of which, a certain city in mid-West America got a nasty surprise (this one
had to be hushed up, which is why we can't name the (ex-)city):
It's not just our customers who get it wrong. A few days ago, we were testing the latest improvement in the design of our Demon air-to-air missiles. One of our programmers had allocated a huge character buffer so that he could use
gets() to capture a keypress. He thought 8192 bytes would be enough. Unfortunately, the operator responsible for entering this keypress had fallen asleep at the keyboard (he later claimed he was suffering from radiation sickness, but we don't accept this at all. He's rarely exposed to more than 300R per day). His nose held the spacebar down for a few minutes. As a consequence, we would like to apologise to the relatives of anyone living in a number of cities in Texas, Arizona, California, and Cuba (sorry, Castro - believe us, this was an accident (this time)). We're not too worried about apologising to the ex-citizens of Redmond, WA, however. It's their own fault for living there in the first place. As Kaz said at the time, "I ran it on my DeathStation 9000, and Demons flew out of my NOSE".