-dip1000 and non-scope variables
Walter Bright
newshound2 at digitalmars.com
Fri Feb 19 00:48:59 UTC 2021
On 2/18/2021 2:05 AM, RazvanN wrote:
> I am terribly
> confused on what the behavior should be. Example:
>
> class MinPointerRecorder
> {
> int* minPrice;
> void update(ref int price) @safe
> {
> minPrice = &price; /* Should not compile. */
> }
> }
To figure it out, rewrite it in the form of using pointers:
void update(int** p, ref int price) @safe
{
*p = &price;
}
which shouldn't compile, but does.
More information about the Digitalmars-d
mailing list