scope parameter has effect only on pointers?
Neto
netorib94 at gmail.com
Sun Jun 22 15:08:58 UTC 2025
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?
More information about the Digitalmars-d-learn
mailing list