bounds checking:在编程中指对数组、字符串、缓冲区等的索引或读写范围进行检查,确保访问没有超出允许的上下界,从而避免越界读写、崩溃或安全漏洞(如缓冲区溢出)。
/baʊndz ˈtʃekɪŋ/
由 bounds(“边界、界限”,源自中古法语 bounde 等,指“限制/界线”)与 checking(“检查”,来自 check,最早与国际象棋中的“将军”相关,后引申为“核对/制止”)组合而成;在计算机语境中常专指“对访问范围进行核对”。
Always enable bounds checking when reading user input into a buffer.
在把用户输入读入缓冲区时,务必启用边界检查。
The language runtime performs bounds checking on every array access, which improves safety but may reduce performance in tight loops.
该语言运行时对每次数组访问都进行边界检查,这提升了安全性,但在紧密循环中可能降低性能。