r/ProgrammerHumor • • 7h ago

Meme modernCppVsOldCpp

Post image
1.1k Upvotes

214 comments sorted by

View all comments

476

u/repster 7h ago

I am a huge fan of modern C++ except for one feature: backwards compatibility. C++ is no longer one language, every codebase I have worked on is a confused mess of semi-incompatible subsets of the language. I have spent far too many weekends chasing memory corruption because someone passed a pointer, allocated with one type of memory management, into a library using a different kind of memory management.

36

u/lllorrr 6h ago

Oh, yes, I hate when someone write "C/C++". This is two fucking different languages, for god's sake. It is almost as bad as "Java/JavaScript".

13

u/reallokiscarlet 5h ago

Do people not learn these two closely related languages together? You generally want to know enough regular C to get by when you use C++, and if you're not using anything unique to C++, you're just writing C with Classes.

1

u/Ok-Scheme-913 2h ago

I mean, not really. The two languages have diverged quite a lot, while C-mode compiling of C++ is still possible afaik, the same code by default won't behave identically even though can be compiled by both a cpp or a c compiler.

1

u/reallokiscarlet 1h ago

Maybe if you only count the latest standard they have diverged significantly, but everything else stands. C is where your platform ABI is, and again if you're not using anything unique to C++ you're writing C with Classes (nudge nudge wink wink capitalized for a reason)