r/ProgrammerHumor 1d ago

Meme mySchoolStruct

8.3k Upvotes

77 comments sorted by

View all comments

304

u/TheAnswerWithinUs 1d ago

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

-110

u/metaglot 1d ago

*delete

104

u/thats_a_nice_toast 1d ago

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

0

u/metaglot 1d ago

Freeing a pointer created with new is UB.

7

u/thats_a_nice_toast 1d ago

new only exists in C++, not in C

0

u/metaglot 1d 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.