D Logic bug
    Nick Treleaven 
    nick at geany.org
       
    Mon Oct 15 09:11:05 UTC 2018
    
    
  
On Thursday, 11 October 2018 at 23:17:15 UTC, Jonathan Marler 
wrote:
> For example, the "Conditional operator" in D actually has a 
> higher priority than an assignment, but in C++ it's the same 
> and is evaluated right-to-left.  So this expression would be 
> different in C++ and D:
>
> a ? b : c = d
>
> In D it would be:
>
> (a ? b : c ) = d
>
> And in C++ would be:
>
> a ? b : (c = d)
This is now deprecated:
      int b = 1, c = 1;
      1 ? b : c = 0;
Deprecation: `1 ? b : c` must be surrounded by parentheses when 
next to operator `=`
https://dlang.org/changelog/2.082.0.html#cond_assign
    
    
More information about the Digitalmars-d
mailing list