this post was submitted on 29 Dec 2024
332 points (98.8% liked)

Programmer Humor

19887 readers
411 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 1 week ago (1 children)

In C++ you should never have owning raw pointers. Unless you have a good reason™.

Raw pointers are great, but not for ownership.

[–] [email protected] 6 points 1 week ago* (last edited 1 week ago) (1 children)

I just use unique_ptr 99% of the time

[–] [email protected] 4 points 1 week ago

And you should.

It even works for classes whose constructors your implementation cannot see, if you aren't a bitch about it.