4 ms·
Or, as I've taken to calling it, C+C++. All jokes aside, this is just too nitpicky for me. I'm not sure if the author is personally upset that C and C++ get lu
by jchw 3y ago
Or, as I've taken to calling it, C+C++.
All jokes aside, this is just too nitpicky for me. I'm not sure if the author is personally upset that C and C++ get lumped together because they don't like C++ or something, or if they have some other gripe with the confusion, but I think it's very obvious why C and C++ get grouped together: they're... Similar and related.
The argument is "No; they're not similar! They're actually very different" and I simply reject this. Yes, they are not the same. Idiomatic C code and idiomatic C++ code are quite different. They are not compatible.
Yet, they share many concepts that basically only languages derived from C do. They aren't compatible, but mostly because they diverged over time, and it's easy to port C code to work in C++ (typically it can be done mechanically, unless you count some newer features.) Hell, is there a C++ compiler that doesn't support (some form of) C?
And while idiomatic C code and idiomatic C++ code may differ, they're not oceans apart. What really sets C++ code apart in my mind is the concepts of RAII and operator overloading. The existence of classes with inheritance may push you to code a certain way, but I think a lot of modern codebases don't even wind up using inheritance the way you might traditionally. For example, it has become common to only use inheritance for pure virtual base classes, using inheritance to implement a sort of interface composition system instead. This is also not so different from a pattern you would often see in C software where you pass a table of function pointers to implement polymorphic behaviors... In fact, it's basically the same thing.
C and C++ may feel far apart to die hard fans of only C, but it should signal something that most of the rest of the world doesn't really see it. C and C++ are definitely different, but fundamentally closer than C and C++ are to many other languages, including languages with C in the name like C#, and arguably "modern" successors like D and Go, too. (Not to mention Rust.)
I am certain that this notion does upset people because they feel it gives C a bad name, but people are always going to have misconceptions and misplaced stigma about your favorite things sometimes. Policing the way people speak is not an answer, not necessarily because there's no truth to the point that "C/C++" for example is misleading, but because there's enough truth to the point that "C/C++" makes sense to make it difficult to convince people to stop naturally associating the two.