Improve type generic programming
gustedt.wordpress.com
gustedt.wordpress.com
And platforms that keep C alive like UNIX clones.
C++ doesn't cramp your style if you'd prefer to write C-style code, but it gives you the power to do much more, and on your own schedule and in your own way. Why on earth would you choose to use the much less capable plain C?
Christ, it's not like the moment you switch the compiler from gcc to g++ a demon comes and bonks you over the head with the GoF design patterns book. C++ can be as much like C as you want.
There is a special day per year to break that rule, and it already gone for 2021.
- more ways to do things -> more effort required to keep somewhat uniform style
- linus and friends just get to decide. (they can be as subjective as they want. The "their house their rules" kind of thing).
- there is no "c/c++" language. there is c and there is c++. they have different std libraries, different idioms, and expert overlap is not that high.
- linux kernel even in c is a huge success - so c is good enough for linux (enough kernel developers are comfortible and productive with it).
- linux might have succeeded with cpp if it were used from the start, but now it's too late. Migration to cpp is a no-go: benefits do not outweigh costs (old code will not be rewritten in cpp, so people maintaining code will now have to be profficient in c AND cpp).
"CppCon 2016: Dan Saks “extern c: Talking to C Programmers about C++”
Some of these features proposed in this paper would be simple additions that have already been battle-tested in real compilers (gcc and clang already have ‘auto’ by using __auto_type, gcc and clang already have 'typeof’). I am less sanguine about adding any form of capturing closures (by value or by reference), but non-capturing function literals that get desugared to anonymous static functions would be a usability win.
Personally I don't have a problem with the approach that C++ acts as an experimentation testbed for C to find the few good language features that should eventually trickle into C after they've proven their worth in real-world C++ codebases for at least a decade or so ;)
If they wanted to port the library to C++, they would have already. This would let them use something common to the C ecosystem, thus potentially harmonious with other libraries, and hopefully bring some compiler-level discipline to the non-Euclidean insanity.
i guess that was a wordy thought, but all the same...
It's actually more compatible with the existing C code base than C is. If you're not familiar:
https://andrewkelley.me/post/zig-cc-powerful-drop-in-replace...
and an IRL use case:
https://dev.to/kristoff/zig-makes-go-cross-compilation-just-...
This doesn’t make me confident that it is well maintained. I”m more interested in how it compiles the Linux kernel, or GNU tools, or any complex C code (and how it performs)
if you're worried about maintenance, it's pretty high priority, given that the overall strategy for zig seems like "embrace, extend, and extinguish", with this being a key driver of the "extend" fork of the strategy.
If that's not enough for you, it's my plan to later this year put up a bounty to for someone to demonstrate compilation of the BEAM virtual machine with zig cc. That's "basically an operating system".