Since issue 8185 has been closed, I'm still very confused. I just understood that endless discussion doesn't result in anything.

See example from http://d.puremagic.com/issues/show_bug.cgi?id=8185#c40
---
int f(size_t p) pure
{
    return *cast(int*) p;
}

void g(size_t p, ref size_t) pure
{
    ++*cast(int*) p;
}

void h(size_t a, size_t b) pure
{
    int res = f(a);
    g(b, b);
    assert(res == f(a)); // may fail, no guaranties by language!
}

void main()
{
    int a;
    h(cast(size_t) &a, cast(size_t) &a);
}
---

Jonathan M Davis (whose documentation correcting pull closed the issue) told me that this code result in undefined behaviour. What _exectly_ language rule this violates? I don't see this rule, but if there is no such rule, how can we treat anything as strongly pure function?

--
Денис В. Шеломовский
Denis V. Shelomovskij

Reply via email to