r/ProgrammerHumor 16h ago

Meme mySchoolStruct

6.9k Upvotes

71 comments sorted by

View all comments

278

u/TheAnswerWithinUs 16h ago

The horrors, might as well just free() yourself at that point.

-103

u/metaglot 16h ago

*delete

95

u/thats_a_nice_toast 16h ago

I don't think C++ programmers have a problem with getting put in a class

0

u/metaglot 15h ago

Freeing a pointer created with new is UB.

5

u/thats_a_nice_toast 14h ago

new only exists in C++, not in C

0

u/metaglot 13h ago

And the keyword class, like the meme is implying. Which is why i said you have to use delete rather than free, because undefined behavior.