4 ms·
If everything everyone wanted was added to C, it would be C++. :-) The C++ evolution is essentially an iterative cycle where people hackily create new languag
by saalweachter 7y ago
If everything everyone wanted was added to C, it would be C++. :-)
The C++ evolution is essentially an iterative cycle where people hackily create new language features with insane preprocessor and template hackery, and then the Standards Committee comes in and takes the most popular hacks and tries to turn them into real language features. And then people create new hacks on top of that.
C says, you want object oriented polymorphism, you've got structs and function pointers, what more do you need?
- krapp 7y ago>C says, you want object oriented polymorphism, you've got structs and function pointers, what more do you need? No, C says your first mistake was wanting object oriented polymorphism. Your second mistake will be implementing it.
- saagarjha 7y agoMost large C projects end up succumbing to something like this at some point.
- cardiffspaceman 7y agoI participated in the coding of several arcade games in Z80 assembler in the late 80s. Not "a" large project but a collection of small ones. These programs, by the time I came aboard and started sharing code with those to make the games I was involved in, had also "succumbed" to this force. The shared bedrock of all these games was code that used certain Z80 registers as pointers to take advantage of instructions that read or wrote fixed offsets from those pointers. The first byte of the record pointed at by the pointer was the type and the next 4 bytes were the position. The rest of the record depended on the type. That was us doing the best we could with 8-bit processors when our competition was using 68000.
- Mikhail_Edoshin 7y agoMany C projects indeed have polymorphism (I believe io libraries do exactly that to implement the idea that "everything is a file"), but this is rather different from object-oriented polymorphism.
- saalweachter 7y agoThis is of course implicit in the mindsets -- C++ is continually trying to support new idioms for the programmer to express themselves, C would prefer you stick as close as possible to a smaller set of idioms. Just because you can technically make use of a design pattern in C, doesn't mean the language (or the community) will ever encourage that.