Thank you!

Basile B. b2.temp at gmx.com
Wed Sep 8 12:28:13 UTC 2021


On Tuesday, 7 September 2021 at 13:36:39 UTC, Tejas wrote:
> On Tuesday, 7 September 2021 at 08:46:48 UTC, Basile B. wrote:
>> On Tuesday, 7 September 2021 at 05:01:30 UTC, Tejas wrote:
>>> On Tuesday, 7 September 2021 at 01:34:01 UTC, Basile B. wrote:
>>>> [...]
>>>
>>> Don't you think it would be better to raise a warning though 
>>> instead of silently fixing it?
>>
>> no. as compiler experiment people can add a flag to generated 
>> temproaries and then printf on a visitor for VarExp and then 
>> will probabably be surprised by the amount of message printf'd 
>> like 2567 times
>>
>> "look boy am saving expressivity for ya here"
>>
>>>
>>> It would help people understand the differences between [...]
>
>
>
> ```d
> import std.stdio;
>
> struct S { int i; }
>
> S _s;
>
> S s (){return _s;}
>
> void main()
> {
>     s().i = 42;
>     writeln(_s.i == 42);
> }
>
> Output:
> false
> ```
>
> Wow, compiler help much appreciated

I see that the conversation has forked on the validity of this 
kind of code, so I've should have chosen a better example (set 
`i` storage to `__gshared`). The point was just to show that 
tempraries a created.




More information about the Digitalmars-d mailing list