Scope & Structs
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Sat Oct 12 23:12:56 UTC 2024
On 13/10/2024 3:12 AM, Salih Dincer wrote:
> You are not wrong, when it is a struct, it is being heap allocated.
>
> Looks like the optimization for classes, hasn't been applied to structs.
>
> https://issues.dlang.org/show_bug.cgi?id=24806 <https://
> issues.dlang.org/show_bug.cgi?id=24806>
>
> So if |scope| is a facility for classes, it should give an error when
> used in structures. Is that so? I understand this from the issue you opened.
``scope`` offers protection from escaping.
It is functioning correctly.
The problem is an optimization you want, isn't being applied by the
frontend, but is elsewhere.
More information about the Digitalmars-d-learn
mailing list