“Error: -1”, a trip down memory lane

Posted by & filed under , , .

Microsoft Windows NT Server Version 4.0I gave a talk last night to Austin CTO Club, where I made a reference to “Error: -1” … only to realize right away that I had dated myself in doing so πŸ™‚ The audience was kind enough to go with it but I had to explain afterwards what it meant. And that compelled me to write this post, for those of you who interact with me and occasionally hear me reference this metaphor.

This is ancient history so brace yourselves! We are talking about times when dinosaurs still roamed the Earth, T-Rex just signed the first deal for Jurassic Park … and Microsoft had just released Windows NT 4.

During that time, there were armies of C and C++ engineers who were writing multi-platform code targeting various Unix flavors, since pretty much Unix was the platform for the servers. To appease these engineers and to penetrate the server market, Microsoft made the decision to make Windows NT4 POSIX-compliant. This meant that all the C/C++ multi-platform code could be easily now ported on Windows NT4 ! And companies reacted to this. On one hand because Linux was not a thing yet (remember, we are talking dinosaurs time!) and also because the price difference in between say an IBM AIX or Sun Solaris system and an NT4 server at the time was day and night). And lots of codebases were quickly changed to include NT4. (And I confess that I was part of that move — and still have nightmares about the #define‘s I had to deal with to achieve this!) As such, lots of server software started running on NT4; and this lead to a lot more crash dialog messages on Windows software which went upon the lines of this:


“The program XYZ has encountered an unexpected error and Windows had to shut it down. The reason for this failure are given below:
Error: -1″


The problem was that while the NT4 kernel was POSIX-compliant, the UI hadn’t caught up to it yet. In POSIX standards, when a function (C function) fails, it is meant to return -1 to signal the error; and the actual error code is stored in a global variable errno — which can then be used to look up the error message. Windows SDK though was used to returning error codes , and as I said, with the UI not caught up with the POSIX standard, they would use the returned value (-1) directly to look up an error message, which would fail — thus resulting in the useless message “The reason was : Error -1”

And these crash messages and useless message were so common that it became a “meme” (before memes existed), and the phrase “error: -1” was used a lot in engineering circles to describe something you can’t make sense of — hence my reference in my talk.

Thank you for indulging me! πŸ™‚