this post was submitted on 09 Jun 2024
607 points (98.3% liked)

Programmer Humor

19512 readers
347 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 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] 33550336@lemmy.world 9 points 5 months ago (5 children)
[–] Vlyn@lemmy.zip 34 points 5 months ago (1 children)

Well, there's modern C++ and it looks reasonable, so you start to think: This isn't so bad, I can work with that.

Then you join a company and you find out: They do have modern C++ code, but also half a million lines of older code that's not in the same style. So there's 5 different ways to do things and just getting a simple string suddenly has you casting classes and calling functions you have no clue about. And there's a ton of different ways to shoot your foot off without warning.

After going to C# I haven't looked back.

[–] 5C5C5C@programming.dev 16 points 5 months ago* (last edited 5 months ago) (2 children)

And even if you do get to use pure modern C++ you'll still get burned by subtle cases of undefined behavior (e.g. you probably haven't memorized every iterator invalidation rule for every container type) that force you to spend weeks debugging an inexplicable crash that happened in production but can only be recreated in 1/10000 runs of your test suite, but vanishes entirely if you compile in debug mode and try to use gdb.

And don't even get me started on multi-threading and concurrency.

[–] felbane@lemmy.world 5 points 5 months ago (1 children)
[–] 5C5C5C@programming.dev 9 points 5 months ago

I'm not sure if you're genuinely asking what a test suite is or if this is a sarcistic joke about how no one bothers to test their C++ code.

[–] SatouKazuma@programming.dev 3 points 5 months ago (1 children)

This is why I moved over to Rust

[–] 5C5C5C@programming.dev 3 points 5 months ago (1 children)

🦀🦀🦀🦀🦀🦀🦀🦀

[–] SatouKazuma@programming.dev 1 points 5 months ago (1 children)

Rustacean supremacy (not to be racist, because we avoid race conditions in the first place)

[–] 5C5C5C@programming.dev 2 points 5 months ago (1 children)

Sorry to be pedantic but Rust only guarantees no data races can happen. It does not prevent race conditions more generally.

Don't get me wrong, I absolutely love the language for sparing me from the hell that is data races, but the language alone won't solve race conditions for you.

[–] SatouKazuma@programming.dev 1 points 5 months ago

Man, you had to go and rain on my parade. 😞

[–] rambling_lunatic@sh.itjust.works 9 points 5 months ago

It's C with feeping creaturism. Some of the features are good. Others not so much. Personally I agree with Torvalds overall.

[–] trxxruraxvr@lemmy.world 9 points 5 months ago

Depends on your frame of reference.

[–] RoyaltyInTraining@lemmy.world 5 points 5 months ago (1 children)

It's a decent language I guess. My main criticism is that the constructor paradigm just isn't well suited for RAII. I always find myself retrofitting Rust's style of object creation into my C++ code.

[–] hector@sh.itjust.works 3 points 5 months ago

Yeah exactly what I experienced. You just end up rewriting Rust constructs!