5 ms·
In many cases it's also enough to just enable LTO to give the compiler enough information for stamping out a specialized version. But TBH I'm a bit tired of pe
by flohofwoe 4y ago
In many cases it's also enough to just enable LTO to give the compiler enough information for stamping out a specialized version.
But TBH I'm a bit tired of people shitting on the C preprocessor. It's a relatively simple text replacement tool, and provides an incredible amount of bang for the buck (e.g. many problems can be solved without having to add more specialized bells and whistles to the language). It's a trade-off like anything else in computing.
- jaridivak 4y ago> many problems can be solved without having to invent new language features You mean something like a type checker?
- WalterBright 4y agoThe C preprocessor was an easy and compact way to extend C back when memory was really really tight. You can't even fit a C++98 compiler into DOS's memory space, but you can fit a C compiler in 64K. (Well, an earlier version of C.) C has been adding generics anyway, like _Generic.
- alphaglosined 4y agoAbout a year ago I had a look at a C compiler for 16bit computers, featured in disk form on I think Adrian's digital basement YT channel. 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.
- WalterBright 4y agoI wrote one back in 1983 or so for 16 bit DOS, too! 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...
- actionfromafar 4y agoWow, in 1983 I hadn’t even seen a hard disk in person!
- WalterBright 4y agoI had one back then, but I did say "a few years later...".
- 1980phipsi 4y agoWhat versions did you offer otherwise? I don't recall CD becoming popular on computers until the 90s.
- 1ris 4y ago>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.
- murdoze 4y agoAgree, but it's nowhere near TASM or even MASM macro processor ;0)