Purity with references and pointers
Jonathan M Davis
jmdavisProg at gmx.com
Sat Sep 18 17:24:26 PDT 2010
If a pure function takes a reference/pointer, does that state that the result of
the function will be the same on two calls to it if the reference/pointer points
to the same data in both cases or if the data itself is unchanged?
If it's a matter of pointing to the same data, then that could be horribly
broken. That would mean that as long as I pased in the same reference, the
compiler could cache the result but that the actual result of the function could
have and should have been different for each call because the object pointed to
was altered.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list