That code that could never run? Well, guess what. Now Windows thinks it's Batman
You left your landline number in an error message, you doughnut
On Call Welcome back to On Call, The Register's weekly peer into the dungeon of despair inhabited by those who twitch uncontrollably at the trill of a telephone.
Today's tale comes from a reader we'll call "Theo" and should serve as a warning for anyone ever tempted to insert witty error messages into their code.
The story takes us to a time when VGA and VESA Local Bus were all the rage. "The early days of document imaging," according to Theo.
"I was writing a document indexing program, and I had a critical section," he said. Put simply, the code stored a variable, performed an atomic operation, then acted on the variable.
The code was strictly linear. "There was no way that anything could possibly modify my variable, other than God himself reaching into the machine and moving my electrons," said Theo.
Nope. No way. No chance. Nothing could mess with Theo's variable. It was inconceivable.
At the time, Theo was a Computer Science Major at college and also holding down a 40-hour working week. As such he was a tad weary, so tired in fact that good old-fashioned paranoia kicked in as he wondered "What if...?"
The silence of the racks is deafening, production gear has gone dark – so which wire do we cut?READ MORE
"So I threw in code that wrote the variable to two locations, did the atomic operation, compared the two variables, then, as long as they matched, went about its way."
The variables were integers and if somehow the two did not match (which could never happen, remember?) Theo's code would vomit an error onto the user's screen and force a reset.
While a decent code analyser of today would likely have spotted Theo's paranoid message, such toys were unavailable back then.
The code was tested, the application rolled out and Theo forgot all about it.
It wasn't until quite some time later, after Theo had graduated and moved on to a new company, that his late-night coding paranoia came back to haunt him.
It came in the form of a call to his home landline (remember those?).
"Is this Theo?" the caller asked in a southeastern US drawl.
"Why, yes..." replied Theo, who today would probably have wondered if he was about to be told he'd been involved in an accident or might have had PPI once upon a time.
"My computer," the caller said, "is a racist Batman and it told me to call you!"
Initially flummoxed by the decidedly odd sequence of words in that sentence, Theo floundered until the caller described the Windows dialog box that had appeared on her screen.
And read back the sentence that Theo had left in the code during his paranoid coding frenzy: "Holy race conditions, Batman! X does not equal X! Call Theo immediately if you see this message at <home phone number>!"
"Apparently," Theo told us, "my fear of years earlier had come true; somewhere in the backwoods of Mississippi, a computer decided that the same value written to two different locations suddenly became different values, and displayed the error message I coded in my giddy delirium."
Lucky Theo then got to spend some quality impromptu on-call time explaining to the young scanner operator on the other end of phone what "race conditions" meant.
It was, he said, "a source of relief" for the poor caller, unable to decipher neither Theo's pop-culture references, nor his programmer jargon.
Ever stuck a message in a bit of code that should never, ever be reached only to find your witticisms appearing at the most inopportune moment? Or had a call from the boss asking why there is a messagebox saying "this should not have happened" on the screen? Of course you have, and you should share the moment with an email to On Call.
Where were you 20 years ago? Were you frantically cutting COBOL or adding a crucial extra byte or two to a date field? Or a bodge that might last to, oh, 2050 before it explodes? Who, Me? and On Call would also like to hear your sordid Y2K tales for a festive feast of near-failures and dodged bullets. ®