Instead we got VLAs (now deprecated) and _Generic. Neat but who cares? The C standards committee doesn't really know what to do with the language it seems.
Instead we got VLAs (now deprecated) and _Generic. Neat but who cares? The C standards committee doesn't really know what to do with the language it seems.
There are definite pros and cons to that particular standards methodology. It is, without any question, the most distributable language. The ABI is and will likely always be intact.
Nobody has ever argued that C is anything other than that. It’s about as dead simple as it can be.
There are other languages for other purposes. Rust and C++ are, in all cases I’m aware of, equivalent in performance to their “ideal” C program alternatives.
Nobody has ever argued until just recently that C is or ever has been anything other than what it is or that there is some kind of battle going on between Rust and “c/c++.” Nothing could be more untrue. C and C++ are different things. Though, with a clear lack of understanding you can write a “c” program in c++. The same is true with rust — everything can still be mutable and you can still have undefined behavior very easily (perhaps most easily with IO).
Plenty of other languages exist, too, with other ways of solving these problems. Haskell is a wonderful language which I hope someday to develop with if there was only some way of making it easier to work with file systems without a PHD.
This particular flame war between rust, c, and c++ is so contrived and tired and misleading.
Rather than the purpose of C being an optimizable low-level language, it's more accurate to say that is the niche it carved out for itself.
There's plenty of crap in C that doesn't help with either optimization or a good ABI.
No, not really. C was always, right from the start, a kin to portable assembly. You'd be hard pressed to come up with a language from the 70s which was at the same level or lower than C. Neigher Fortran nor COBOL nor ALGOL nor Lisp nor BASIC were lower level than C. Precisely which language, other than assembly, leads you to believe that C ever was considered a high-level language?
I don't understand what leads anyone to argue otherwise.
C as a low-level language is revisionist history. Rust is a high-level language and yet it is a "lower level" language than Java. Same as C vs Pascal. You could write very low level code in Turbo Pascal back in the 80s, the demoscene used it a lot alongside assembly, it had inline assembly even.
EDIT: and to answer your question on what else was "low-level", Forth.
The only interpretation where this assertion rings remotely true is if you follow a definition of "high level language" which boils down to "it's not assembly", which has not been the case for around half a century.
It makes absolutely no sense to claim that languages such as COBOl and C are even close at the same level of abstraction, just because C is compiled, has loops, and has a standard library.
It was the interpretation back then which is what we're discussing :)
Honest question: why should C change? I mean, if all we want is access to higher-level core language features not provided by C, isn't it better to just pick up a higher-level language that already offers it? After all, if you add higher level features like smart pointers, is it really worth it to keep other features like the extensive reliance on the C preprocessor, dangerous string handling, and a spartan and in some cases outright unsafe standard library? Or would it be better to cut our losses and just adopt languages that already fixed those issues?
I just finished shipping an industrial lighting unit for “smart farms.” I worked extensively on embedded hardware. The most advanced processor I used was armv6, with the majority of hardware being IC or FPGA.
I used C for one thing only: reading the bitstream from microcontrollers into memory. After which point, I used c++ (17) with exclusively standard libraries (one exception: boost’s ASIO for http) to implement any and all other features.
I would have happily used c++ to read those bitstreams, but the code was so unsafe that it refused to compile. Turns out that reading raw bytes from an irregular file descriptor is so arcane and bizarre that no sane modern compiler felt good enough about itself to allow me to compile it.
All that said, I would only ever allow myself to write in C in that isolated case and for that isolated purpose. Every other nanosecond of my codebase runs on modern c++.
Honest answer, there is no legitimate reason to use C. If in some edge case you must, there is no legitimate reason to use it for anything other than that.
But look how many libraries are written in C, such that they can be made available everywhere. Look at how many are written in C++/Rust but with C wrappers with plenty of pointers and bad error handling.
Any improvements to the C standard would have meant a safer surface area for those languages to use to talk to other languages, since C is the english of programming.
There's no reason why C couldn't have namespacing, out-of-band errors, fat pointers, minimal reflection (typeof), standardized attributes, etc. ages ago. None of that would have screwed with the ABI or with optimization, but would have made language interoperability a lot easier.
No, not really. At least in practical terms.
C11 saw some changes, and arguably only minor ones.
C17 is a bugfix update to C11.
And C20 is still in the works, and none of the proposed changes are relevant.
Consequently, C as been dormant since the release of C99, which already was criticized for not bringing anything new to the table other than C++98 tuneups, and support for inline comments (?!)
C11 also had _Generic as a "major" addition (and a crappy one IMO). I agree that if C is not going to evolve in any meaningful way, they should probably just stop adding stuff to it entirely. Either go for a "C++11" or let it be frozen in place.