Speed difference between If-Else and Ternary operator in C…?

后端 未结 6 2315
别跟我提以往
别跟我提以往 2020-12-01 16:49

So at the suggestion of a colleague, I just tested the speed difference between the ternary operator and the equivalent If-Else block... and it seems that the ternary operat

6条回答
  •  北海茫月
    2020-12-01 17:33

    Any decent compiler should generate the same code for these if optimisation is turned on.

提交回复
热议问题