On 2/23/11 9:42 AM, Steven Schveighoffer wrote:
On Wed, 23 Feb 2011 10:35:26 -0500, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> wrote:
free(p) affects data remotely outside the pure function.

This is allowed however in the new pure regime:

pure void foo(int *x) {(*x)++;}

int x;
foo(&x);

Or do you mean something else?

-Steve

At a level it's clear to me that a function cannot be at the same time pure and unsafe. For example:

pure void foo(int *x) { free(x); (*x)++; }

This function essentially breaks any guarantee for the entire program, so it would be quite difficult to claim it's pure.


Andrei

Reply via email to