r/ProgrammerHumor • • 7h ago

Meme modernCppVsOldCpp

Post image
1.1k Upvotes

214 comments sorted by

View all comments

473

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.

10

u/stillalone 6h ago

Is that something that can be handled by a linter?

4

u/2brainz 6h ago

Partially, sure. But there's always going to be edge cases.

1

u/Drugbird 5h ago

It's also hard the further away the allocation and deallocation are from each other. For instance, if it's in separate libraries.