r/programminghorror • • Sep 04 '26

c++ Skill Issue

Post image
1.8k Upvotes

63 comments sorted by

View all comments

Show parent comment

5

u/GasolinePizza Sep 04 '26

Isn't each y only evaluated once? The evaluation in the "else if (_s==y)"?

2

u/mapronV Sep 04 '26

only performance problem is not using sized comparison operator, due to decay of char[] to char*.
so yeah, string_view advice is okay, but this is a joke code, it will not fly in production anyway.

2

u/LeeHide Sep 04 '26

each true one is only evaluated once, but every false one until then is also evaluated.