3 ms·
@inbounds is a Base feature.
by Q6T46nT668w6i3m 4y ago
@inbounds is a Base feature.
- arksingrad 4y ago@inbounds isn't the problem, it's incorrect usage of it. The poor docstring is absolutely a problem though, you should be iterating over eachindex(A), not 1:length(A).
- markkitti 4y agoYes, and it is a perfectly fine feature when applied correctly. It would be incorrect to assume that an `AbstractArray` starts at `1` or `0` which is why the updated example now correctly uses `eachindex`: https://docs.julialang.org/en/v1/devdocs/boundscheck/#Eliding-bounds-checks https://docs.julialang.org/en/v1/devdocs/boundscheck/#Elidin... If you want to assume that an array starts at `1` one needs to require an `Array` rather than an `AbstractArray`.