Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-pointer-arithmetic.rst

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