I wouldn’t say “need”, but there are possible improvements to ergonomics and safety that wouldn’t make the language itself more complex or high level. I think it does its job quite well though and will be here for decades to come.
Every programming language is an abstraction layer between the programmer and the machine that will run the code. But abstraction isn’t free. Generally speaking, the higher the abstraction, the less efficient the program.
C++ optionally provides a much higher level of abstraction than pure C, which makes C++ much nicer to work with. But the trade off is that the program will struggle to run in resource constrained environments, where a program written in C would run just fine.
And to be clear, when I say “low-end hardware”, I’m not talking about the atom-based netbook from 2008 you picked up for $15 at a yard sale. It will run C++ based programs just fine. I’m talking about 8- or 16-bit microcontrollers running at <100 MHz with a couple of hundred kB of RAM. Such machines are still common in many embedded applications, and they do not handle C++ applications gracefully.
And speed too. A small program using only C features can compile 5x faster with a c compiler then a c++ one. (GCC will use c++ mode on a .cop file so make sure it is .c)
Ada has been around since 1983 and is objectively superior. Yes I will die on that hill.
It’s too bad programmers are all such egotards they think they can write bugfree programs in C, while whining about how “restrictive” a safe language like Ada is.
And just like in Metal Gear, he dies of old age if you wait a bit.
C is old, ubiquitous and still does not have a good replacement for its low-level cross-platform usecases, so I’ll believe it when I see it 😄
Does it need replacing?
I wouldn’t say “need”, but there are possible improvements to ergonomics and safety that wouldn’t make the language itself more complex or high level. I think it does its job quite well though and will be here for decades to come.
deleted by creator
I mean yeah, if you restrict yourself to the C part of C++ it can do everything C can. But then you’re not getting any of the advantages of C++.
Once you start using things like classes and templates heavily, your program will quickly outgrow low-end hardware.
“Outgrow low-end hardware”?
What does a programming language have to do with this?
Everything.
Every programming language is an abstraction layer between the programmer and the machine that will run the code. But abstraction isn’t free. Generally speaking, the higher the abstraction, the less efficient the program.
C++ optionally provides a much higher level of abstraction than pure C, which makes C++ much nicer to work with. But the trade off is that the program will struggle to run in resource constrained environments, where a program written in C would run just fine.
And to be clear, when I say “low-end hardware”, I’m not talking about the atom-based netbook from 2008 you picked up for $15 at a yard sale. It will run C++ based programs just fine. I’m talking about 8- or 16-bit microcontrollers running at <100 MHz with a couple of hundred kB of RAM. Such machines are still common in many embedded applications, and they do not handle C++ applications gracefully.
Compile times get insanely huge.
Compile a c program with gcc then with g++.
You will quickly see the difference in size
And speed too. A small program using only C features can compile 5x faster with a c compiler then a c++ one. (GCC will use c++ mode on a .cop file so make sure it is .c)
Ada has been around since 1983 and is objectively superior. Yes I will die on that hill.
It’s too bad programmers are all such egotards they think they can write bugfree programs in C, while whining about how “restrictive” a safe language like Ada is.