In the previous post, you may have noticed a few odd things about the specifics and the design. For example, switches were described as
And here is a small utility header in the project:
// a few simple things used by the rest of the code. typedef int bool; typedef unsigned char byte; #define TRUE 1 #define FALSE 0
There was no built-in
bool type or
false keywords at this time! You might find that hard to fathom, but as I write this in 2017 the existence of
std::byte is brand new and almost no code uses it yet.
Of course, when I learned C there was no such thing as the void type for making void*, names of structure members had to be globally unique and if you used the wrong member name for a variable there was no error — you just got the fixed offset represented by that member name, applied to the wrong type of variable. And functions declarations did not have arguments declared, and the compiler did not check what you passed when calling a function anyway.
Some of the names were scoped as being in
cmdl, but that’s only the flag enumerations defined inside the class (enumerators scoped to the enumeration name itself didn’t come until C++11). The various classes used though are defined globally. Why? Because there were no such thing as namespaces.
cmdl_int type is written specifically for the
int type. Why not a template? Because there were no such thing as templates. And BTW, int for me was 16 bits, running in “real mode” 8086 code.
The makefile shows a symbol that’s defined if I’m compiling under Borland C++ 3, which supports the 2.1 version of the C++ specification.
#ifdef VERSION21 cmdl::errval cmdl::error= OK; #else errval cmdl::error= OK; #endif
Originally, the type (to the left of the name being defined) was implicitly known to be in the same scope. This was changed in version 2.1
I also spotted this little gem:
for (int loop= 0; loop < len; loop++) string[loop]= commandline[loop]; // _fmemcpy() not available in TC++1.01 (a.k.a. "second edition"). Bummer string[len]= '\0';
Turbo C++ 1.0 was released in May 1990, and TC++ 1.01 was released February 28, 1991. Borland C++ 3.0 was released in 1991. That should indicate the true vintage of this code.
Wikipedia chronicles that C++2.0 was released in 1989. As it so happens, I was a reviewer of the spec and documentation before it was finished, and got my name in the Annotated C++ Reference Manual. This added, of note, multiple inheritance, abstract classes, static member functions, and
const member functions, and placement
Version 2.1, noted above as this code was used when 2.0 and 2.1 compilers were both in use, added partial nesting of classes. So that explains why none of the other types were nested inside
cmdl — you could not do such a thing!