To help LDC/GDC

Timon Gehr timon.gehr at gmx.ch
Tue Apr 9 04:39:39 PDT 2013


On 04/09/2013 01:27 PM, Manu wrote:
> ...
>
> The only optimisation possibility is for strong pure functions that are
> also nothrow, right?  Was that the conditions for pure function refactoring?

No, strongly pure functions will always throw the same classes of 
exceptions when called with the same arguments. Therefore, with some 
flow-analysis, common subexpression elimination can apply to strongly 
pure functions which are not nothrow.

Eg, given int foo(int)pure;, the transformation from

a = foo(2);
b = foo(2);

to

a = foo(2);
b = a;

is valid.


More information about the Digitalmars-d mailing list