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.

Reply via email to