this post was submitted on 31 Aug 2025
316 points (96.5% liked)

Programmer Humor

26095 readers
1455 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Finally I have a valid reason to learn about memory management. It was also hella weird when encountering it.

you are viewing a single comment's thread
view the rest of the comments
[–] CookieOfFortune@lemmy.world 10 points 1 day ago (1 children)
[–] resipsaloquitur@lemmy.world 7 points 1 day ago (1 children)

Classes are just pretentious structs.

[–] CookieOfFortune@lemmy.world 3 points 1 day ago (1 children)

How do you get destructor behavior in C?

[–] henfredemars@infosec.pub 2 points 1 day ago* (last edited 1 day ago) (1 children)

You call the destructor. It’s simply not automatically done for you with the concept of going out of scope.

Back when C++ was simply a text pre-processor for C, you could see these normal function calls. You can still see them in the un-optimized disassembly. There’s nothing magical about a destructor other than it being inserted automatically.

[–] entwine@programming.dev 2 points 22 hours ago

being inserted automatically.

Aka the entire point of RAII