this post was submitted on 30 May 2024
387 points (94.3% liked)

Programmer Humor

32566 readers
273 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 6 months ago (1 children)

C++ classes are fairly optional but if you're already using cpp then it likely wasn't your choice and neither will the choice of OOP.

[–] Buddahriffic 2 points 5 months ago (1 children)

Yeah, I like the sweet spot that C++ is in. It can do anything C can but then you have classes and STL and all that on top of it.

[–] [email protected] 2 points 5 months ago (1 children)

once i learned about defer it became a hard requirement. cpp kinda gives me that but other c like languages do it better.

[–] Buddahriffic 2 points 5 months ago

Yeah, I wish C++ had function/scope epilogs and labeled loops/breaks, too. Those are the cases where the "never use goto" rule can be broken to make better code than adding all of the code that would be required to handle it the "right" way (setting up early exit flags and if statements after each level of nested loop to check the flag).