C has been adding generics anyway, like _Generic.
C has been adding generics anyway, like _Generic.
"_Generic" added function overloads to c, not generics. The naming is exceptionally poor.
The submission is an example of generic programming. It an implementatin of something that works on all types that fullfill certain constrains. In this case comparable and swapable. "All types" include user defined types.
"_Generic" does something completely different. The C++ equvivalent would be std::conditional_v<std::is_same<T, int>, myIntFunc, std::conditional<std::is_same<T, double>, myDoubleFunc ............ The exact opposite of a generic, I'd argue, as myIntFunc and myDoubleFunc do depend on the type. You might use the preprocessor to create these functions that differ only in type, but then again, you might do what OP did.
The compiler was very basic, nothing like you'd expect from a compiler even from the dragon book.
So simple and it was a production compiler too!
Sadly I can't remember the name of it to reference here.
A few years later, I was at a C++ conference where they asked me to sit on an "Ask us anything" panel. I was there along with the developers of Microsoft C, Borland C, etc.
The first question was "do you still ship a version of your compiler that will run on a floppy disk system?"
Vendor 1 said sure, and launched into a long description of how the files could be shuffled about on the floppy to make it work.
Vendor 2 said sure, and launched into ...
My turn. I said sure, and said the floppy disk version costs $200 and comes with a hard disk drive. (That was the price of a hard disk in those days.)
That was the end of that, I never heard that question again from anybody.
Progress...