@nogc inconsistent for array comparison depending on mutability of elements
Dicebot via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Apr 8 06:09:12 PDT 2016
On Friday, 8 April 2016 at 12:45:59 UTC, Xinok wrote:
> On Friday, 8 April 2016 at 10:15:10 UTC, Dicebot wrote:
>> On Friday, 8 April 2016 at 09:56:41 UTC, Nick Treleaven wrote:
>>>> Semantically, array literals are always allocated on the
>>>> heap. In this case, the optimizer can obviously place the
>>>> array on the stack or even make it static/global.
>>>
>>> So @nogc is enforced by the optimizer?
>>
>> Yes, sadly.
>
> What? O_o I stated that it's not and explained why doing so
> would be a bad idea.
It is not enforced by _backend_ optimizer as all relevant checks
are done by frontend but the fact of will you get error or not
does depend on semantics that are currently defined as optional
optimizations. Like putting array literal on stack.
More information about the Digitalmars-d-learn
mailing list