I
Ian Collins
Exactly, in OO languages, you can opt to bounds check or not to boundsMalcolm said:If you treat arays as "objects" it becomes natural for an access to
cause code to be executed. C++ even allows overloading of the subscript
operator to permit this. You can have bounds checking in non-OO
languages, but it implies special compiler tricks and / or hidden
variables.
check, or even both for debug/non-debug builds. With non-OO languages,
you don't have that choice. So the former gives the programmer the
choice of safety or speed, throwing away cycles is an option, not
something imposed by the language.
It's the programmer's choice to "throw away cycles", not the language's.