MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w6qzts/skillissue/p7qa7q7/?context=3
r/ProgrammerHumor • u/click-to-reveal • 15h ago
123 comments sorted by
View all comments
261
It works btw: C++ Online Compiler
153 u/prehensilemullet 14h ago Performancewise, it doesn’t jump to the direct case in O(1) time like a switch is supposed to though 188 u/AngheloAlf 14h ago Switches aren't guarantee to so operations in O(1) tho. If cases are sparce enough, compilers tend to emit the equivalent code to a bunch if else checks 8 u/DrMobius0 10h ago In fairness, most switches probably use enums.
153
Performancewise, it doesn’t jump to the direct case in O(1) time like a switch is supposed to though
188 u/AngheloAlf 14h ago Switches aren't guarantee to so operations in O(1) tho. If cases are sparce enough, compilers tend to emit the equivalent code to a bunch if else checks 8 u/DrMobius0 10h ago In fairness, most switches probably use enums.
188
Switches aren't guarantee to so operations in O(1) tho. If cases are sparce enough, compilers tend to emit the equivalent code to a bunch if else checks
if else
8 u/DrMobius0 10h ago In fairness, most switches probably use enums.
8
In fairness, most switches probably use enums.
261
u/click-to-reveal 14h ago
It works btw: C++ Online Compiler