Branch on ?: operator?

后端 未结 5 1047
Happy的楠姐
Happy的楠姐 2021-01-17 23:45

For a typical modern compiler on modern hardware, will the ? : operator result in a branch that affects the instruction pipeline?

In other words which i

5条回答
  •  一个人的身影
    2021-01-18 00:24

    Calling a function is at least as expensive as doing a logic test + jump (and yes, the ? : ternary operator would require a jump).

提交回复
热议问题