"David Piepgrass" , dans le message (digitalmars.D:172164), a écrit : >>> Yeah, I've been planning to try and get this into D one day. >>> Probably >>> something like: >>> (a ?: b) -> (auto __tmp = a, __tmp ? __tmp : b) >> >> gcc used to have that extension and they dropped it... > > But GCC can't control the C++ language spec. Naturally there is a > reluctance to add nonstandard features. It's a successful feature > in C#, however, and a lot of people (including me) have also been > pestering the C# crew for "null dot" (for safely calling methods > on object references that might be null.) > > I don't see why you would use ?: instead of ??, though.
Because ?: is the ternary conditionnal operator with missing second operand. a ?: b // or maybe a ? : b is just a short hand for a ? a : b (except a is evaluated only once).