that is bug?

Ali Çehreli acehreli at yahoo.com
Mon Apr 9 03:35:07 UTC 2018


On 04/08/2018 09:59 AM, Patrick Schluter wrote:
> On Sunday, 8 April 2018 at 16:47:59 UTC, Patrick Schluter wrote:
>> On Sunday, 8 April 2018 at 10:03:33 UTC, kdevel wrote:
>>> On Sunday, 8 April 2018 at 07:22:19 UTC, Patrick Schluter wrote:
>>>> [...]
>>>
>>> To summarize: C++ works as expected and C prevents the assigment 
>>> because the conditional operator does not yield an l-value:
>>
>> Exactly
>>
>>
>> Now, the only thing is to clearly define what it is in D, as 
>> apparently it is neither the C++ nor the C behaviour. The old 
>> precedence table on the D wiki seems to say it is like C, but the 
>> example of that thread seems to show it's not.
> 
> To follow up. What's surprizing for a C guy like me is that D accepts 
> without problems
> 
>     (a=1)=2;
> 
> i.e. that (a=1) is a lvalue.

I don't have any problem with that part either. The following makes 
sense to me. I may have even used it in the past (likely in C++):

     (cond ? a : b) = foo;

Ali


More information about the Digitalmars-d mailing list