If I understand const right...

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 23 14:26:49 PDT 2016


On 23.03.2016 22:18, cy wrote:
> On Wednesday, 23 March 2016 at 21:10:49 UTC, ag0aep6g wrote:
[...]
>> b = new int(*b + 1);
> Here "b" is pointing to mutable heap allocated data, which got cast to
> constant.
>
> with b = b + 1, it's still constant memory.

It's stack memory. Its constness isn't any more physical than with `new`.


More information about the Digitalmars-d-learn mailing list