--- Comment #12 from 2012-06-03 12:46:28 PDT ---
(In reply to comment #11)
> Pointers may only access their own memory blocks, therefore exactly those
> blocks participate in argument value and return value.

What does 'their own memory block' mean? The problem is a pointer is basically
an unbounded array, and, if the access isn't restricted somehow, makes the
function dependent on global memory state.

> But why does it even matter? Isn't this discussion mostly philosophical?

The compiler will happily assume that template functions are pure even when
they clearly are not, and there isn't even a way to mark such functions as
"impure" (w/o using hacks like calling dummy functions etc).
Example - a function that is designed to operate on arrays, will always be
called with a pointer to inside an array, and can assume that the previous and
next element is always valid: 

  f4(T)(T* p) {
      p[-1] += p[0];

The compiler thinks f4() is pure, when it clearly is not; optimizations based
on that assumption are likely to result in corrupted data.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to