The wording is slightly confusing, but if you study it in detail you'll find that it's actually very precise.
It says this:
- The precondition is that the argument to
[]
is either = n or it's < n.
- Assuming that precondition is satisfied:
- If it's < n then you get the character you asked for.
- "Otherwise" (i.e. if it's n) then you get
charT()
(i.e. the null character).
But no rule is defined for when you break the precondition, and the check for = n can be satisfied implicitly (but isn't explicitly mandated to be) by actually storing a charT()
at position n.
So implementations don't need to perform any bounds checking… and the common ones won't.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…