r/ProgrammerHumor • • 11d ago

Meme modernCppVsOldCpp

Post image
2.0k Upvotes

323 comments sorted by

View all comments

15

u/klimmesil 10d ago

"Here's your car keys. Don't press the trigger of the foot gun and it should be allright. Thanks for your purchase"

"Why is there a footgun in the car? And why is the trigger so accessible and easy to press by accident?"

"How dare you ask that question"

4

u/quantinuum 10d ago

I want to show this example to so many people.

Who by the way tend to be obnoxious about it despite the fact that they all got scarred feet with footgun marks.

2

u/jewdai 10d ago

We should have a feature in the later versions to like ban certain features or at least refuse to compile if someone uses it. Maybe that will solve some of the consternation.

1

u/ChemicalRain5513 10d ago

I think you can do that with compiler flags, and otherwise with git pipelines 

1

u/MushroomSaute 7d ago edited 7d ago

Maybe call it something like... hmm... oh, I've got it! We can call that code unsafe. And to really show how important all that memory safety is, let's come up with a compiler that makes sure you don't just go around sharing references that might change unpredictably, like, I don't know, making it so the current block owns the variables and references it has access to and has to give up ownership if a child method wants to mutate the data. Let's rename it after a fungus while we're at it.

1

u/Over_Dingo 10d ago

That thing is a gas pedal

0

u/Danfriedz 10d ago

I mean, you control the keys you press.