On 2013-12-09 09:45, Walter Bright wrote:
Try this:pure int foo (int a, int b) nothrow { return a + b; } int test() { return foo(1, 2) + foo(1, 2); } Compile with: dmd foo -O -release -c And dump the assembly: push EAX mov EAX,2 push 1 call near ptr _D3foo3fooFNaNbiiZi add EAX,EAX pop ECX ret Granted, more cases can be done, but it *does* take advantage of purity here and there.
Yeah, that worked. I tried to do as simple case I could think of. -- /Jacob Carlborg