[Issue 20964] poor CTFE support for backward pointer iteration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 22 06:40:27 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=20964

--- Comment #4 from Илья Ярошенко <ilyayaroshenko at gmail.com> ---
(In reply to Walter Bright from comment #2)
> It is not normal practice nor allowed by the memory model to point before
> the beginning of a memory block. Pointing one past the end is allowed.
> 
> The conventional solution is to use pre-decrement for reversing, that way
> the iteration can start with a pointer one past the end.

I am not sure what do you mean by memory model. If you mean a GC model, than it
is fine to free the memory as soon as the point moved out of the left bound. At
least that works well for Mir.

> I'm not understanding why the conventional solution won't work for your case.

It may work. It is just annoying to rework it each time. We have a code that
works in runtime and we expect it works at compile time, however it doesn't.

--


More information about the Digitalmars-d-bugs mailing list