Why would you use C instead of C++?

Why would you use C instead of C++? Is C dead? These are common questions I see on a frequent basis and in this article I will give my opinion and discuss the matter.

First, C is not dead. Second, while C++ has similarities to C, they are not the same language. C is a procedural language, C++ supports procedural and object-oriented programming, which can be a positive but it makes the language larger! One of the advantages of C is that it is smaller, which is one of the reasons that it is suited to embedded electronics. C is a faster language. C++ has more keywords and grammar than C. C is good for demanding and low-level tasks. Used where speed and efficiency is important. C gives a programmer a lot of freedom. This is why it is used for operating systems and embedded systems. This is both powerful and dangerous! C is close to the machine, while C++ has more abstraction.

The NSA said that programmers should stop using C and C++ and instead use memory-safe languages because most security vulnerabilities are caused by bugs in memory usage. The NSA is saying that C and C++ are memory-unsafe languages. Rust is the common alternative that is suggested. C and C++ provide a lot of freedom and flexibility and this is one of the reasons that I think that we should continue to use it. The problem is not the language, the problem is the code that’s been written. Surely the solution is to encourage and educate programmers in making their code secure. Java is often cited as a secure language, yet there have been some major security problems caused by Java code! Speed is another issue. Minecraft is available in Java and non-Java versions, the Java version is slower, partly because it has to run inside a Java virtual machine. A lot of experts agree, it would be better to stick with C and C++ and work to improve the issues outlined.