So, I've seen a lot of people asking me this question, about what does C/C++ mean.
Well, for new software developers this might not make any sense, after all, why do these companies put in their job listing “we want a C/C++ developer”?
I've had this doubt myself back then and this is totally normal.
This is exactly what George asked me:
“What I don't understand is why I always see C/C++ in the job listing, as far as I know those are different languages and somebody told me that C is mostly for hardware and embedded devices and I'm currently not that interested in that but why do we always see the C/C++ thing and not only one language, do people really always use both languages at the same job?Is it a bad idea to leave C aside and focus on C++ because I am really interested in competitive programming right now?”
So, do you wanna know why some companies ask for C/C++ programmers? Watch this video and find out!
John Sonmez: Hey, what’s up, John Sonmez from simpleprogrammer.com. Today we’re going to be talking about C and C++. I’ve got this question—I thought this was a good one. I haven’t really seen too many people ask this question, but I know that a lot of people are confused by it. I was confused by this earlier on in my career. It’s titled C/C++ Confusion. This question comes from George and he says, “What I don’t understand is why I always see C/C++ in the job listing, as far as I know those are different languages and somebody told me that C is mostly for hardware and embedded devices and I’m currently not that interested in that, but why do we always see the C/C++ thing and not only one language? Do people really always use both languages at the same jobs? Is it a bad idea to leave C aside and focus on C++ because I am really interested in competitive programming right now?”
This is a good question. This is something that I had often wondered about. I can tell you about this from my—if I go way back to my early days of programming as a C/C++ developer, mostly a C++ developer and I can tell you why that this exists.
The primary reason why this exists—well, let’s talk about the languages. C++ is a super set of C for the most part. Now, there are some small exceptions to this, but for the most part, everything that is valid in C is valid in C++ and so C++ is C plus more, C plus plus hence the name. But everything in C++ is not compatible with C. You can’t write C++ code and run it in the C compiler, but you can take C code for the most part and run it in C++ because C++ is a super set.
That’s where this initially comes from is essentially you can write C code and you can use it in C++. Now there are different styles of writing the code because C is a procedural language. It’s not object oriented where C++ is object oriented, although there are ways to write object oriented C now, so I hear, sounds scary to me.
So now why do we have this confusion? Why do jobs say C/C++? Well, it’s because there’s a lot of developers especially on legacy systems and some old, old school developers that have been writing C/C++ code for a long time, especially ones that have been writing C code for a long time who don’t really know the difference and sort of mix it together, a lot.
What I found commonly, I worked at a little company called Hewlett Packard for a while and I worked on some of the firmware there on some of the printers and it was C/C++. It was literally C/C++ because what you had was you had a lot of firmware developers that were old school C developers, okay? Some new fangled kid came in and said, “You guys start doing C++ and object oriented programming.” They said, “No!” and he said, “Well that’s what we’re doing.” So they started using C++ but they started writing the C++ code as if it were C. they didn’t use objects or they created these huge—we call them God objects, it’s a codes mountain and they would write it just like C. So there’s a lot of code out there that is written that way so you’ve got to have the C/C++ skills.
You’re essentially using the C++ language features but you’re abusing them because you’re not writing them in an object oriented way. That’s what a lot of development environments that are kind of old school in that way have that C/C++. Because the languages can technically be mixed because you can technically use C++ features and write them in a C way or you can use write C code and put it into C++ compiler that’s why you see that so often.
Now as far as recommendations, if you’re a C++ developer you should have some familiarity with C. You’re going to have to know C. If you learn C++—if you know CC++ you know C. You just don’t know how to write idiomatic C, so you might want to look at how people write idiomatic C especially in low level firmware stuff. Although a lot of it is C++ now and gain that understanding. In general, if you know C++ you can look at C code and understand what it’s doing.
There are some contexts, some arguments for writing C instead of C++, C++ is a lot more complicated than C and there’re plenty of environments where they just do plain C. But I would not invest heavily into plain C. I don’t think that’s a good investment. I did a video on how to learn C++ and I basically said not to do that and I still kind of stand by that. I mean if you want to learn C++ it will make you really smart, too smart and it will be really hard, but it’s rewarding because it’s a difficult language to learn. There’s a lot to learn and a lot of ways to blow your whole foot off as the creator of C++ Bjarne Stroustrup famously said.
There you have it. That’s where we’ve got that little bit of history. If someone else has some background on this and would like to chime in, leave a comment below. If you’ve got a question for me, you can email me at john@simpleprogrammer.com. If you liked this video, if you want to subscribe to the channel, just go ahead and click that subscribe button below and you’ll get more videos like this one about all kinds of programming, topics, life, career, philosophy, fitness, you name it. We talk about it here on this channel as it relates to a software developer’s life and beyond. I’ll talk to you next time. Take care.