[Issue 17363] @safety hole due to $ caching in slice expressions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed May 3 12:21:20 PDT 2017


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

--- Comment #2 from kinke at gmx.net ---
> The slice should be loaded before evaluation of slice arguments, then length
> is safe to cache, see issue 17364.

Your argument for loading & caching length and pointer before evaluating the
bounds expressions being?
I mean it's perfectly safe and IMHO less awkward the other way around, loading
the current length for each $ and loading the base pointer after evaluating the
bounds expressions, with full side effects visibility for lvalue slicees.
People do come up with (arguably bad) code where this matters:
https://github.com/ldc-developers/ldc/issues/1433

--


More information about the Digitalmars-d-bugs mailing list