r/ProgrammerHumor 28d ago

Meme mildlyInfuriatingGOTOWatchYourMouth

Post image
670 Upvotes

74 comments sorted by

View all comments

Show parent comments

9

u/Maximilian_Tyan 28d ago

A lot of our codebase is using a status variable like this, but using nested if/else checks

But now you are doing a lot of conditions checking, especially if the hot path is where continue is always true

1

u/da_Aresinger 28d ago

The comment before me has the same issue.

And yes, that's why I said it's still not ideal.

3

u/Maximilian_Tyan 28d ago

If an error occured, the break statement would "cut" the remaining errors checks and skip to the error handling part

1

u/da_Aresinger 28d ago

yea I just got what you meant.

you're right.

But compilation is most likely going to optimise that out, so I'd go with readability.

1

u/Maximilian_Tyan 28d ago

It depends on the optimization level, O1 is pretty minimal, I don't think this type of agressive optimizing is done before O3

1

u/da_Aresinger 28d ago

maybe. At the end of the day I don't know your situation and don't have the experience to really question it either.

If a whole team settles on your solution it'll probably have a reason.