A classic blunder, like getting involved in a land war in Asia

The first time [1] I included some BASIC (Beginners All-purpose Symbolic Instruction Code) code, I typed in the sample directly from a magazine (like we used to do back in the 1980s). The second (and most recent) time I included BASIC code [2], it was extracted from a disk image downloaded from the Intarwebs (using code I wrote) and then decoded into ASCII (American Standard Code for Information Interchange), using code I wrote, based off a text file I also found on the Intarwebs. I didn't notice when I posted the code because it was a wall of text 32 characters wide (the width of the text screen on a Color Computer). It was only months later when I finally noticed all the THENNOTs littering the code.

There was nothing wrong with the actual file, but I did locate the bug in my code:

char const *const c_tokens[] =
{
  "FOR",
  "GO",
  /* ... */
  "SUB",
  "THEN"
  "NOT",
  "STEP",
  "OFF",
  /* ... */
  "DSKO$",
  "DOS"
};

If you look close, you'll see there's a missing comma after the THEN token, and in C, two literal strings separated by whitespace are concatenated into a single string. Thus, all the THENNOTs I was seeing. And a bunch of incorrect code because most of the BASIC keywords were then off-by-one (a classic mistake of C programming).

[1] /boston/2008/01/04.1

[2] /boston/2023/05/10.1

Gemini Mention this post

Contact the author