Does a C++ programmer need learning C in 2019

Hi all,

I know that how powerful both C and C++ are. C++ added some new features to C and evolved throughout this long time up to now that we see something efficient and new almost each year in it.
You might say, it depends upon the areas I may be involved in to go for C or not even if I know C++. But can't C++ cover all what C offer? And on the other hand some people, like Stroustrup, say C is obsolete, so it almost completely withholds a person like me from going for C in 2019.
Now what are your opinions on the title please?

Learn C if you plan to use it.
If you're a good C++ programmer, and get a job at a company that uses C, you will likely be able to pick it up on the job.

But can't C++ cover all what C offer?

C has a number of language features not available in C++, but more importantly, there are many hardware platforms for which C compilers exist, but C++ compilers don't (or are unusable).
There also are software projects that traditionally use C, such as the Linux kernel. You'll have to learn C if you plan to contribute to it in 2019, or in any other year.
Last edited on
A lot of C code is still mixed into C++ programs in some fields. I still have a number of tools that generate C code (its easier to make a tool that makes C or C-like C++ than object oriented modern style and some of this stuff has been around forever) and sometimes you have to hack on it a little. If you find yourself having to read, edit, and manage C code, you should learn at least the basics.

The good news is that you can learn enough C to get by in a month or 2. Its a much simpler language. If you already understand pointers very well, that time will be cut significantly.

Stroustrup has a lot of very strong opinions. Lets leave it at that -- I respect him a lot, so this is not intended to be in any way an insult. There are a lot of 'dead' languages that are used every single day. C is nowhere near dead (compared to say, smalltalk or lisp or pascal etc), and won't be in my lifetime, nor most likely, yours.

Cubbi, what can C do that C++ cannot? Not syntax tricks, but actual functionality... I was under the opinion you can do anything in C++, and C just makes a few things a little easier (and the reverse, c++ makes many things easier).


Last edited on
jonnin wrote:
Cubbi, what can C do that C++ cannot? Not syntax tricks, but actual functionality..

restricted pointers are the biggest one: they make C as fast as Fortran. Many people tried to work them into standard C++ but failed every time.
Other C-only features are perhaps replaceable in some ways, though often at cost (VLAs, designated initializers for arrays/structs, compound literals, generic macros, anon structs, static array parameters, flexible array members, complex numbers in core language, etc)
Last edited on
thanks!
I wasn't going to open the performance rabbit hole. It takes a pretty complex program to notice the difference.
Are there any compilers that support restrict in C but not in C++ as an extension, though? That would seem kind of senseless.
Thanks to all,

I got to that conclusion that C++ can support all what C can, but not vice versa, for example, classes.

But for something like network/socket programming, the majority of perspectives might consider a C reference better to understand the fundamentals for a beginner, compared to similar stuff in C++.

Not to forget, there are some OSes like Unix or Linux that might be mostly or entirely written in C, but the most popular OS, Windows, especially its new ones (7 and 10), are mostly written in C++. Is it not?
closed account (E0p9LyTq)
Windows, especially its new ones (7 and 10), are mostly written in C++. Is it not?

About 2 years ago:

https://www.reddit.com/r/cpp/comments/4oruo1/windows_10_coded_in_c_or_assembler/

Kernel proper - This is mostly written in C. Things like the memory manager, object manager, etc. are mostly written in C. The boot loaders are written in ASM, but set up a C environment rather quickly.

Drivers - that said, a lot of newer kernel mode drivers are actually written in C++ (however, its style is more akin to "C with classes". Lower level code has been much slower to adopting anything past C++98)

.....

Shell code (newer code like Cortana, the new start menu, and the WinRT APIs) are ahead of the curve in terms of implementation practices and C++14/17 usage. (I, for example, have recently investigated how co_await could simplify my product's code).

.....

The inbox universal apps are written in C++ and C# and target the actual public WinRT API surface (to the best of my knowledge). We really do try to eat our own dogfood, and that goes for writing apps against public APIs too.
Topic archived. No new replies allowed.