3 ms·
Why was the conditional expression in the C++ code converted to an if statement in the C# code? C# has conditional expressions.
by mattnewport 8y ago
Why was the conditional expression in the C++ code converted to an if statement in the C# code? C# has conditional expressions.
- EpicEng 8y agoNote the use of the comma operator in the C++ version. C# has no equivalent, hence the introduction of 'temp'. The first part is just adding to o.x, the bit after the comma is the result of the expression, which is what is passed to min. The += part would not evaluate to a value. It's ugly.
- ken 8y agoIt's been a while since I've used C#, but I'd guess it's because the C++ is doing a "+=" with ",", to cram two statements in there, while C# considers "+=" a toplevel statement only and doesn't allow it to be used with ",".