5 ms·
Note that some users of GC languages that support stack allocation, are used that it is a compiler error trying to have such a pointer/reference. D example, ht
by pjmlp 2y ago
Note that some users of GC languages that support stack allocation, are used that it is a compiler error trying to have such a pointer/reference.
D example, https://godbolt.org/z/bbfbeb19a https://godbolt.org/z/bbfbeb19a
> Error: returning `& my_value` escapes a reference to local variable `my_value`
C# example, https://godbolt.org/z/Y8MfYMMrT https://godbolt.org/z/Y8MfYMMrT
> error CS8168: Cannot return local 'num' by reference because it is not a ref local