Advantage of switch over if-else statement

后端 未结 22 2374
梦谈多话
梦谈多话 2020-11-22 11:08

What\'s the best practice for using a switch statement vs using an if statement for 30 unsigned enumerations where about 10 have an ex

22条回答
  •  温柔的废话
    2020-11-22 12:01

    while (true) != while (loop)
    

    Probably the first one is optimised by the compiler, that would explain why the second loop is slower when increasing loop count.

提交回复
热议问题