cppcoreguidelines-pro-bounds-constant-array-index¶
This check flags all array subscript expressions on static arrays and
std::arrays
that either do not have a constant integer expression index or
are out of bounds (for std::array
). For out-of-bounds checking of static
arrays, see the -Warray-bounds Clang diagnostic.
This rule is part of the “Bounds safety” profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arrayindex.
Optionally, this check can generate fixes using gsl::at
for indexing.