D 50% slower than C++. What I'm doing wrong?

Kevin Cox kevincox.ca at gmail.com
Sun Apr 15 05:23:04 PDT 2012


On Apr 15, 2012 4:30 AM, "Joseph Rushton Wakeling" <
joseph.wakeling at webdrake.net> wrote:
> ... the compiler accepts it.  Whether that's because it's acceptably
pure, or because the compiler just doesn't detect this case of impurity, is
another matter.  The int k is certainly mutable from outside the scope of
the function, so AFAICS it _should_ be disallowed.

As far as I understand pure includes the "hidden this parameter"  so it is
pure if when you call it on the same structure with the same arguments you
always get the same results.  Although that seams pretty useless in the
optimization standpoint because the function can modify it's own object
between calls.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120415/dc2812cb/attachment.html>


More information about the Digitalmars-d-learn mailing list