Sometimes there are ways of getting runtime bounds checking.
For example, both of these return the 3rd element of a std::vector:
auto val1 = vec[3]; // no bounds checking auto val2 = vec.at(3); // bounds checking
Yes, with the trade-off of essentially requiring exceptions, which are also banned in some codebases.
Yes, with the trade-off of essentially requiring exceptions, which are also banned in some codebases.