this post was submitted on 01 Aug 2025
156 points (99.4% liked)

Programmer Humor

25425 readers
1301 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
[–] Lembot_0004@discuss.online 38 points 1 day ago (13 children)

It might be an absolutely adequate method. Imagine that is C++. operator-- is overloaded and controls some machinery. You can't just command capacity = currSize. Process is important.

[–] marcos@lemmy.world 16 points 1 day ago (1 children)

Yeah, just to say it more clearly: that kind of thing is why lots of people out there insist that operator overloading is a bad idea.

And yeah, it's a C++ thing that mostly doesn't happen in other languages.

[–] TeamAssimilation 2 points 22 hours ago

Sincerely agree. Explicit is better then implicit, that’s a general engineering axiom.

Instead of overloading and making the next maintainer hunt for overloads, a clearly named function that does the critical steps would make the code immensely more maintainable. C++ is C gone wild.

load more comments (11 replies)