Eliding of slice range checking

kinke kinke at gmx.net
Wed Oct 23 11:33:56 UTC 2019


On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote:
> How can I investigate the codegen myself here?

Simply check the IR or asm, e.g., on run.dlang.io. If there's a 
call to `_d_arraybounds` in the function of interest, bounds 
checks are enabled.

For your example, the template is inferred to be @safe, and 
`-release` only elides bounds checks in @system functions 
(corresponding to `-boundscheck=safeonly`). Use 
`-boundscheck=off` to elide it in all functions.


More information about the Digitalmars-d-learn mailing list