Performance improvements for D / DMD compiler.
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Sat Jan 20 15:44:09 PST 2007
janderson wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> janderson wrote:
>>> Walter Bright wrote:
>>>> Andrei Alexandrescu (See Website For Email) wrote:
>>>>> No, and for a good reason:
>>>>>
>>>>> foo(LargeStruct s1, LargeStruct s2)
>>>>> {
>>>>> ...
>>>>> }
>>>>> ...
>>>>> LargeStruct s;
>>>>> foo(s, s);
>>>>>
>>>>> Nobody would enjoy hidden aliasing of s1 and s2.
>>>
>>> I think you mean more like:
>>>
>>>
>>> foo(LargeStruct s1, LargeStruct inout s2)
>>> {
>>> ...
>>> }
>>> ...
>>> LargeStruct s;
>>> foo(s, s);
>>
>> I meant what I wrote, although your example is just as relevant. If
>> the compiler takes initiative in passing things by reference, there is
>> risk of unintended aliasing.
>>
>>
>> Andrei
>
> If all the function does is read the values. How can aliasing be a
> problem?
Probably I misunderstood some of what was said earlier in the
discussion, sorry. My current understanding is that we're on the same
page: there is an aliasing issue that needs proper addressing. :o)
Andrei
More information about the Digitalmars-d
mailing list