Proposal: Operator overloading without temporaries

Sean Kelly sean at f4.ca
Tue Mar 28 09:14:40 PST 2006


Don Clugston wrote:
> You raise a good point, though -- unavoidable temporaries could be 
> treated better (eg with memory pools), this proposal does not let you 
> distinguish between "new temporary = a+b " and "new result = a+b", the 
> former could be stored in a memory pool. I think that's a minor issue, 
> though.

I think that's something that could be added as a Quality of 
Implementation issue without violating the rules you've outlined.  ie. 
it doesn't matter where the memory comes from.  Temporaries could even 
be allocated using alloca in some cases.

As for other issues with the behavior--so long as this is spelled out in 
the spec then I don't see any problems with it.  As you've said, it's 
what's actually happening behind the scenes anyway, but defining it this 
way makes for the most efficient code generation possible, and this is a 
fantastic guarantee to have in the case of large objects.


Sean



More information about the Digitalmars-d mailing list