Optimisation possibilities: current, future and enhancements
ag0aep6g via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 26 13:35:13 PDT 2016
On 08/26/2016 10:09 PM, Patrick Schluter wrote:
> Yes. The optimisation of removing the second call is only possible if
> there is no access using the this pointer. The call to setN() (or any
> member function using the mutable this pointer), will mandate the
> compiler to call getN() again.
If setN is called or not does not affect getN's purity, though. You
wrote that (the method) getN is not pure and should be rejected by the
compiler, but both variants (method and function) are equally pure or
impure.
More information about the Digitalmars-d
mailing list