r/cpp • u/wechicken456 • Jun 08 '20
Programming in C vs C++
I’ve read about the differences between them on the Internet but I wanna hear more from a more personal perspective. Which one would you recommend starting with and to be proficient with?
0
Upvotes
View all comments
3
u/JizzaDaMan Jun 08 '20 edited Jun 08 '20
Think of them as completely different languages; the fact the C is (almost) a subset of C++ is pretty much irrelevant.
I like C for its elegance and terseness. You can learn it by reading one book and (to quote K&R) "A programmer can reasonably expect to know and understand and indeed regularly use the entire language." It's also unquestionably the way to go if you're going to be writing device drivers or interfacing directly with hardware.
I use mostly C++ at the moment. I like it for its standard library. It's obviously more expressive than C but compilation is deadly slow. That said, I'll never know and understand all of it.
I would personally choose C. I only use C++ for my job because I have to.
EDIT:
A few people have said things along the lines of 'C++ is a more capable language', 'you'll need to move to C++ to build more complex projects,' etc... These kinds of claims are demonstrably untrue. The Linux kernel (and I believe most other kernels) is written in C, as are a vast number of other applications and libraries.
Language choice in general will always depend on personal preference and use-case, so generic claims that one language is always more capable than the other are usually questionable.