Re:Branch predictor: How many “if”s are too many?
by MaxBarraclough on Thursday May 06, 2021 @12:14PM
(#27065438)
Following that line, it's never exactly been syntactic sugar. When initializing a const local, you can use the ternary operator on the right hand side of the assignment, but you can't get the same effect using if (short of writing a new function). Similarly, C++ lets you use the ternary operator for the left hand side of an assignment, (a ? b : c) = 42; although you could use an if for this pretty easily.
[ Parent
| on HN ]
Re:Branch predictor: How many “if”s are too many?
by andromeduck on Thursday May 06, 2021 @02:08PM
(#27067077)
Wow I had no idea you could use it on the LHS. TIL.
Re:Branch predictor: How many “if”s are too many?
by MaxBarraclough on Thursday May 06, 2021 @06:39PM
(#27069833)
A TIL of my own: it seems not to be allowed in C.