Performance improvements for D / DMD compiler.
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Sat Jan 20 09:57:30 PST 2007
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
More information about the Digitalmars-d
mailing list