Compiler could elide many more postblit constructor calls

TommiT tommitissari at hotmail.com
Sun Jun 30 02:38:47 PDT 2013


On Sunday, 30 June 2013 at 09:24:28 UTC, Diggory wrote:
> [..]
>
> Also, the function needs to be strongly pure, not just weakly 
> pure, otherwise the calling code could pass in both the const 
> variable and a non-const reference to that variable. If the 
> callee modifies the non-const reference it would see the 
> changes to the const parameter which it shouldn't be able to do.

Good point. So, in order to elide postblit when a const variable 
is passed by value as a const argument, the function would not 
only need to be pure, but also all of its parameters would have 
to be either const or immutable.


More information about the Digitalmars-d mailing list