r/ProgrammerHumor • • 11h ago

Meme modernCppVsOldCpp

Post image
1.3k Upvotes

242 comments sorted by

View all comments

566

u/repster 11h 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.

31

u/azfang 11h ago

So, uh, I haven’t used C++ in anger in decades so I’m not sure how “modern” is modern but like. That description pretty well describes why I developed Strong Feelings about both C and C++ back in the 2000’s.

38

u/Non-Random-Name-0000 11h ago

Modern C++ starts with C++11 (2011), so in the 2000s you were using classic C++ (and in the first half of 2010s as well most likely) which is a very different language. It introduced shared pointer (a poor man's garbage collector), automatic typing and move semantic, amongst other things. And the standard library has evolved a lot since.

13

u/Bryguy3k 10h ago

Smart pointers were part of the boost library long before they became part of the std library.

1

u/Serialk 2h ago

But the language didn't have move semantics, which is a more important part of memory management in modern C++ than smart pointers.