this give the error:

```d
@safe:
int *gp2;
int g(scope int *p)
{
        gp2 = p;
        return -1;
}
```

 Error: scope variable p assigned to non-scope gp2

but this one doesn't give any error:

```d
@safe:

int gg;

int f(scope int c)
{
        int k = c;
        gg = c;
        return k * 8;
}
```

this is why `c` is a "simple variable" can be allocated onto stack and copied without any issue? if not, why exactly this one doesn't give error?
  • scope parameter ... Neto via Digitalmars-d-learn
    • Re: scope p... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: sco... Dom DiSc via Digitalmars-d-learn
        • Re:... user1234 via Digitalmars-d-learn
        • Re:... Dennis via Digitalmars-d-learn
          • ... Jonathan M Davis via Digitalmars-d-learn
          • ... Quirin Schroll via Digitalmars-d-learn
            • ... Jonathan M Davis via Digitalmars-d-learn

Reply via email to