-dip1000 and non-scope variables

Dukc ajieskola at gmail.com
Fri Feb 19 09:49:54 UTC 2021


On Friday, 19 February 2021 at 00:48:59 UTC, Walter Bright wrote:
> To figure it out, rewrite it in the form of using pointers:
>
>     void update(int** p, ref int price) @safe
>     {
>         *p = &price;
>     }
>

Wouldn't the pointer rewrite be
```
void update(int** p, int* price) @safe
{ *p = price;
}
```
?

The compiler should infer that `p` can be `scope`, but `price` 
can't.

> which shouldn't compile

Why?




More information about the Digitalmars-d mailing list