• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. title:: clang-tidy - cppcoreguidelines-pro-bounds-pointer-arithmetic
2
3cppcoreguidelines-pro-bounds-pointer-arithmetic
4===============================================
5
6This check flags all usage of pointer arithmetic, because it could lead to an
7invalid pointer. Subtraction of two pointers is not flagged by this check.
8
9Pointers should only refer to single objects, and pointer arithmetic is fragile
10and easy to get wrong. ``span<T>`` is a bounds-checked, safe type for accessing
11arrays of data.
12
13This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see
14https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arithmetic.
15