It was 1990 or possibly 1991, and I was working for System Simulation on an Application for Windows 2 – which at that time was a rather exotic extra that a few adventurous people were running on top of their MS-DOS systems. There was no graphical development environment in those days: you’d compile your program using the command-line C compiler cl, and compile your resources (dialogue boxes, menus and suchlike) using the command-line resource compiler, rc.
Although this was a bit laborious, it did work, and I was able to make some progress working on and off on this project through June and July. Then the first time I tried to rebuild the resources in August, the compiler rejected my files with a spectacularly uninformative error message: “bad octal digit”. It gave no indication of where in the file the problem was.
Anyone have an idea what was happening yet?
OK, last hint: I would have run into this problem before August if I’d been working full-time on the Windows project, rather than switching between this and other work. Specifically, the problem would have manifested in both June and July, but only on the 8th and 9th of the month.
Got it now?
It was a bug in the resource compiler. For some reason, its lexical analyser worked its way through comments, identifying and discarding lexical tokens within the comments rather than just identifying and discarding the entire comment. We were using a header-comment that contained the magic sequence %D%, which SCCS expands into the current date – this is nice because it means the first line of your file includes a note of when it was modified (and by whom, and what the file is called, depending on what other magic sequences you include).
The date was being rendered with the month in zero-padded form – so when I checked the file in on the first of August and tried to compile it, the header said something like:
/* st.rc, version 1.23, last modified 01/08/1990 */
And the resource compiler, seeing the sequence “08” in the middle of that comment, decided that the leading zero meant an octal integer constant, and then rejected it because 8 is not a valid octal digit.
Har har. How we laughed.
Lessons for today? Although the specific tool that did this is long gone, the obvious moral is that whatever else your development tools do, they should emit clear, specific error messages. It’s bad enough that rc lexed its way through my comment, but if had at least had the decency to say “bad octal constant ‘08’ at st.rc, line 1” then I wouldn’t have had to waste half a day scratching my head.
[Note: this post is modified from one that I posted in 2009 on my employer’s blog, but in contravention of basic Web etiquette, it’s vanished in a subsequent revamp of the site. The WayBack Machine has it but I don’t want to rely on that.]