用法:
@boundscheck(blk)
将表达式 blk 注释为边界检查块,允许它被   省略。@inbounds 
注意
写入@boundscheck 的函数必须内联到它的调用者中才能使@inbounds 生效。
例子
julia> @inline function g(A, i)
           @boundscheck checkbounds(A, i)
           return "accessing ($A)[$i]"
       end;
julia> f1() = return g(1:2, -1);
julia> f2() = @inbounds return g(1:2, -1);
julia> f1()
ERROR: BoundsError: attempt to access 2-element UnitRange{Int64} at index [-1]
Stacktrace:
 [1] throw_boundserror(::UnitRange{Int64}, ::Tuple{Int64}) at ./abstractarray.jl:455
 [2] checkbounds at ./abstractarray.jl:420 [inlined]
 [3] g at ./none:2 [inlined]
 [4] f1() at ./none:1
 [5] top-level scope
julia> f2()
"accessing (1:2)[-1]"警告
@boundscheck 注释允许您作为库编写者 opt-in 以允许 other code 使用   删除边界检查。如上所述,调用者必须在使用 @inbounds @inbounds 之前使用他们可以访问的信息验证他们的访问是否有效。例如,对于您的   子类的索引,这涉及根据其 AbstractArray   检查索引。因此,axes @boundscheck 注释应仅在您确定其行为正确后添加到   或 getindex   实现。setindex! 
相关用法
- Julia @b_str用法及代码示例
 - Julia @cfunction用法及代码示例
 - Julia @view用法及代码示例
 - Julia @isdefined用法及代码示例
 - Julia @v_str用法及代码示例
 - Julia @show用法及代码示例
 - Julia @r_str用法及代码示例
 - Julia @locals用法及代码示例
 - Julia @raw_str用法及代码示例
 - Julia @coalesce用法及代码示例
 - Julia @assert用法及代码示例
 - Julia @ccall用法及代码示例
 - Julia @views用法及代码示例
 - Julia @task用法及代码示例
 - Julia @something用法及代码示例
 - Julia @deprecate用法及代码示例
 - Julia splice!用法及代码示例
 - Julia LibGit2.count用法及代码示例
 - Julia LinearAlgebra.BLAS.dot用法及代码示例
 - Julia break用法及代码示例
 - Julia sizeof()用法及代码示例
 - Julia :<=用法及代码示例
 - Julia zero()用法及代码示例
 - Julia rem用法及代码示例
 - Julia ...用法及代码示例
 
注:本文由纯净天空筛选整理自julialang.org 大神的英文原创作品 Base.@boundscheck — Macro。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
