P.S: there's a book called "The design and evolution of C++" which you should probably read. Where can one learn more about the design of C?
I'm a huge fan of Rust and I can only dream of having all C codebases in the wild ported to it some day but I'm still writing C at work because it's faster, easier (vendors provide C libraries and code, not Rust) and it's easier to hire C coders than Rust ones.
>P.S: there's a book called "The design and evolution of C++" which you should probably read. Where can one learn more about the design of C?
I'd be surprised if C was really ever "designed" the way we would design a language these days. Basically it was a fork of earlier languages tweaked to more conveniently model the hardware of the time. It was more about getting the job done at the time than making an innovative language. At least that's what I gathered from what I know about the early days of C and it's also fairly apparent in the way the language itself is designed (the whole pointer/array shenanigans come to mind). C is many things but it's definitely not elegant or even clever.
There is an history of 10 years of systems programming languages, preceding it. Prooving one does not need to throw security out of the window in systems languages.
Had Bell Labs been allowed to sell UNIX, instead of giving it away for a symbolic price and C would have been a footnote on history of system languages.
I agree that if we're talking about why C took over in the first place it's a different discussion.
I was mainly referring to new projects, where C continues to be selected because of a myriad of reasons, none related to technical uniqueness or superiority.
This is truly infuriating, because we will collectively pay for those poor choices in security vulnerabilities.
Furthermore even brand new projects will have to interface with existing code to some extent. C bindings are everywhere, Rust not always. And even when they exist they're not always complete and are often quite experimental.
Still, I'm doing my part and I did write a few smaller components of my current project in Rust at work. But it's not surprising that the shift is not happening overnight.
AUTOSAR now requires C++14 compliance on software certification.
Android, ChromeOS, Windows, Apple OSes native components are mostly written in C++.
Finally, all major C compilers are written in C++ nowadays.
The only places where C++ is failing to replace C, is among developers unwilling to move beyond C89 on embedded space, or UNIX clones.
But it is impossible to create a beautiful, "properly designed" programming language that's also backwards compatible with C. I mean look at Objective-C :)
C is simpler than C++ until we need to manage memory or need to handle basic data structures. When that happens, C requires reinventing the wheel over and over again.
"As simple as possible, but no simpler."
In fact C++ allows for flexible memory allocation strategies per data structure, while C forces one to hand code them all and replacing something like malloc affects the whole executable behavior.
You realize that that's not exactly flexible. Tieing shape to behaviour in this way is where the pain starts.
And the fact is that it does. In the rare case that it doesn't then C++ also accomosdates those requirements if developers are willing to put in the same sort of effort that goes into implementing data structures by hand.
Well engineered tools have quality as their main focus.
C won its place in the world thanks to UNIX adoption, and its commoditization via free beer OSes, nothing else.
C is C and C++ is C++. The analogy breaks down in a pretty major way because Latin has no native speakers, but important work is done in C. They didn't stop speaking Latin because it had problems as a language, they stopped because the cultural apparatus behind Latin collapsed after an exceptionally long period of dominance that Italian speakers never achieved.
I'd like to believe C has a stronger future in the academic world because it is simpler than C++, but also because C is a designed language and C++ is a cobbled-together language, and maybe that counts for something in a field where people call themselves engineers.
Anyone who sees C as a 'downgrade' has badly misunderstood what design means as an engineering concept. It doesn't mean 'does everything', it means that strategic choices were made early in the process after careful consideration.
* Serious hat *
C has a pretty well defended place in the world - it is an excellent choice for manipulating RAM and controlling the size of variables. C++ isn't as good, because its features add a lot of complexity that isn't really desirable when you have a problem that C can handle.
I wouldn't use it for string parsing. Or GUIs except as an afterthought on a project that used C for a good reason.