GC.malloc is pure - wat

via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 24 08:29:57 PDT 2015


On Friday, 24 April 2015 at 15:21:43 UTC, Steven Schveighoffer 
wrote:
> Any call to foo could be cached and avoided. This is allowed by 
> the compiler (but I'm not sure if the optimization is 
> implemented).

It does, but only in the same expression, i.e.

auto a = sin(x) * sin(x);    // sin() is called only once

but:

auto a = sin(x);
auto b = sin(x);             // sin() is called again here


More information about the Digitalmars-d mailing list