Ask HN: Will the C programming language really die?
There is too much talking about Rust programming language and it's great that research on this topic is vibrant.
My question.
Will the C programming language really die? Meaning, stop being used as a System programming Language or in the Embedded Systems field.
It is still worth to invest some time digging these topics with the C programming language?
Newbie here, don't be rude.
9 comments
[ 5.1 ms ] story [ 30.7 ms ] threadFortran is still in use after ~60 years, but it isn't really being used for new applications, which seesm to be what you're asking. It seems safe to assume that someday C will follow suit.
I started learning C almost 30 years ago and while I have learned a lot of other languages: C++, Java, Scheme, Dylan, NewtonScript, Visual BASIC, some Haskell, a little Forth, various assembly languages... recently I received training in LabView.
I keep winding up using C again. I spent today writing C code that runs on an embedded board. Simple code, really, running on an embedded processor with very little RAM. There's still a need for this. I have most of modern C++ available on this platform. It is technically C++, but I'm not using any classes or templates, so it looks for the most part very much like C99.
As someone who is well-acquainted with C's weaknesses as well as strengths, I would honestly like it if I could migrate all my work to something else. I really like functional languages and I really like strict type safety. I am looking forward to using Haskell on embedded systems and think it will have a niche there. I'm looking forward to expressing embedded state machines in FRP (functional-reactive). However, these things are still relatively limited and experimental. As for Rust and Go, etc., it's still a chicken-and-egg thing, I think. And I'm not sure they are really suited for _small_ chips -- what's the minimal runtime? Can you get rid of all garbage collection at runtime? And remember that practical issues of tooling are _huge_. They tend to swamp theoretical elegance and even sometimes efficiency by a large margin.
So, I guess the answer is "I don't know." C still has a niche. At some point it may truly be unnecessary. As to whether it is worth studying or investing your time understanding, I would say the answer is almost certainly yes. The C runtime model is still the dominant one; C is still the language used to build most of the tools that other languages are built on. If you need to understand what is going on at the low level, just above assembly language, and programmers still do, they still need to understand C.
Anyone who claims C is dead likely is working in the Silicon Valley startup bubble. Sure, C isn't going to get your far at mostly web based companies but every computing device you own most likely has C and assembly running the hardware bits and the underlying system.
Let's say rust fares better than go, c#, D, java, limbo, modula (-2, -3), oberon, pascal, etc. Programmers around the world race to convert all legacy C code to rust. C, C++ and Objective C are banned under international treaty and everyone suspected of leaking memory is rounded up and sent to coder bootcamps for re-education. Learning C is the second best (behind assembly) programming language to understand how your computer actually works.
1) Being reasonably high level
2) Having asm() be usable at all. You can't drop into asm with Go, as far as I'm aware. You can with Rust and C++, but the next point...
3) The ABI as commonly implemented is dead simple. I know how to call C from asm, and vice versa, without screwing everything up, having bizarre initialization and destruction to worry about, etc. C++ can't claim that. I don't think Rust can either.
C will live on until there's an actually usable replacement. Right now, there isn't.
Rust has no defined ABI at this time, just like C++, but by adding the 'extern' keyword, and a '#[no_mangle]' attribute, you get the C ABI, and so then it's easy. We also support a few other ABIs as well, then it's 'extern "fastcall"' or whatever.
(This still doesn't mean "Rust will kill C" or something silly like that.)