Performance improvements for D / DMD compiler.

janderson askme at me.com
Sat Jan 20 12:30:34 PST 2007


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?

-Joel



More information about the Digitalmars-d mailing list