On Wednesday, 25 May 2016 at 12:06:58 UTC, Adam D. Ruppe wrote:
Slicing and indexing are both allowed (actually, that's a way
to disable bounds checking on an individual expression, see
tip: http://arsdnet.net/this-week-in-d/dec-06.html ) on
pointers, though it isn't considered @safe.
Be careful though: it is still manually managed, so if you pass
it to some function that keeps a slice to your slice, you open
yourself up to a use-after-free bug!
If I knew about this trick in the past, it's been years so it
would have been easy to forget. Still awesome to rediscover.
Rereading a lot of stuff.
As for passing slices to functions, I generally only do that
when I know it won't hold onto it (or try to resize it or
anything weird), which then lets me use stack memory rather than
heap memory for temporaries.