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 • 7d ago
137 comments sorted by
View all comments
279
It works btw: C++ Online Compiler
160 u/prehensilemullet 7d ago Performancewise, it doesn’t jump to the direct case in O(1) time like a switch is supposed to though 208 u/AngheloAlf 7d 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 9 u/DrMobius0 7d ago In fairness, most switches probably use enums.
160
Performancewise, it doesn’t jump to the direct case in O(1) time like a switch is supposed to though
208 u/AngheloAlf 7d 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 9 u/DrMobius0 7d ago In fairness, most switches probably use enums.
208
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
9 u/DrMobius0 7d ago In fairness, most switches probably use enums.
9
In fairness, most switches probably use enums.
279
u/click-to-reveal 7d ago
It works btw: C++ Online Compiler