Not necessarily. A compiler can optimize ?x:0 into a multiply. For example,
f(x) ? y : 0
can also be written as (int)(bool)f(x) * y f(x) ? y : 0
can also be written as (int)(bool)f(x) * yIf the constants had been less convenient numbers, like 42, the compiler could have instead used a conditional move instruction -- more general-purpose, but I believe slightly larger and often ever-so-slightly slower.