Avoiding Range Checks in Slice Expressions

bearophile bearophileHUGS at lycos.com
Sun Mar 30 12:44:30 PDT 2014


Nordlöw:

> Does DMD currently avoid range checks in array slice 
> expressions such as
>
> f(x[0..$/2])
> f(x[$/2..$])

You have two simple ways to answer your question: try to go past 
the slices and look if D raises an error, and look at the asm 
produced with various compiler switches.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list