737
C++ (ani.social)
submitted 3 months ago* (last edited 3 months ago) by kiri@ani.social to c/programmer_humor@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] henfredemars@infosec.pub 71 points 3 months ago

Ah, C++. An endless supply of footguns where the difference between a junior and a senior dev is knowing what parts of the language to never use.

[-] xmunk@sh.itjust.works 26 points 3 months ago

Real C++ programmers pass by const ref and tell pointers to fuck off.

[-] henfredemars@infosec.pub 16 points 3 months ago* (last edited 3 months ago)

You can also make everything a smart pointer and be done with it.

I can count on more than one hand the number of large scale projects where converting everything to smart pointers fixed major memory issues. Even if smart pointers can’t handle circular references, the number of projects that just don’t manage their memory correctly at all and were fixed by introducing these tools is way too high.

[-] xmunk@sh.itjust.works 5 points 3 months ago

This is a bit embarrassing but the last time I actively worked in C++ it was with Qt and pre C++11.

[-] henfredemars@infosec.pub 3 points 3 months ago

Almost the same as me. All kinds of programming jobs. I usually end up working in Python or C, for embedded systems work.

Of course, if you’re talking hobby, it could be anything.

[-] CanadaPlus@lemmy.sdf.org 1 points 3 months ago

Which kind of smart pointer, with which kind of footgun? I mean, it's better than not even trying I guess, but if it was actually a full solution you'd just have Rust.

[-] henfredemars@infosec.pub 9 points 3 months ago

You’re right. It’s a stop gap, but when you’re talking about a code base that has been maintained for 20 years plus you can’t really sell re-implementation.

Most recently it was with an older version of C++ using shared pointers.

[-] qaz@lemmy.world 2 points 3 months ago

const ref or unique_ptr if you need ownership

[-] bleistift2@sopuli.xyz 7 points 3 months ago

I thought C++ was meant to get rid of C’s footguns?

[-] henfredemars@infosec.pub 55 points 3 months ago

It’s almost backwards compatible. You can use old or new foot guns.

[-] dvlsg@lemmy.world 21 points 3 months ago

Hooray, choice!

[-] bitcrafter@programming.dev 21 points 3 months ago

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.

- Bjarne Stroustrup

this post was submitted on 16 Mar 2025
737 points (98.2% liked)

Programmer Humor

24425 readers
110 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