On Monday, 25 November 2019 at 08:32:53 UTC, H. S. Teoh wrote:
On Mon, Nov 25, 2019 at 08:07:50AM +0000, Fanda Vacek via Digitalmars-d-learn wrote: [...]
But anyway, pointers are not allowed in @safe code, so this is not always solution.
[...]

This is incorrect. Pointers *are* allowed in @safe code. Pointer *arithmetic* is not allowed.


--T

void main() @safe
{
        int a = 1;
        int *b = &a;
        *b = 2;
        assert(a == 2);
}

does not compile for me with Error: cannot take address of local `a` in `@safe` function `main`

so there must be more restrictions in @safe code

Fanda

Reply via email to