[Issue 8185] Pure functions and pointers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 4 08:06:12 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8185



--- Comment #34 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-06-04 19:08:08 MSD ---
(In reply to comment #33)
> (In reply to comment #32)
> > That's correct. You should not expect *any* optimizations from weakly pure
> > functions. The ONLY purpose of weakly pure functions is to increase the number
> > of strongly pure functions. In all other respects, they are no different from
> > an impure function.
> 
> Const-pure functions invoked with immutable _arguments_ (even though parameters
> might only be const) can receive exactly the same amount of optimizations. Even
> if not implemented in DMD today (as are many other possible purity-related
> optimizations), this is very useful, because otherwise functions would have to
> accept immutable values just for the sake of optimization even though they
> could work with const values just as well otherwise.

Have you noticed that as I wrote in comment 20 strong unsafe pure functions
like
---
size_t f(size_t) nothrow pure;
---
also almost always can't be optimized out?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list