24 lines · plain
1.. title:: clang-tidy - cppcoreguidelines-pro-bounds-pointer-arithmetic2 3cppcoreguidelines-pro-bounds-pointer-arithmetic4===============================================5 6This check flags all usage of pointer arithmetic, because it could lead to an7invalid pointer. Subtraction of two pointers is not flagged by this check.8 9Pointers should only refer to single objects, and pointer arithmetic is fragile10and easy to get wrong. ``span<T>`` is a bounds-checked, safe type for accessing11arrays of data.12 13This rule is part of the `Bounds safety (Bounds 1)14<https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#pro-bounds-arithmetic>`_15profile from the C++ Core Guidelines.16 17Options18-------19 20.. option:: AllowIncrementDecrementOperators21 22 When enabled, the check will allow using the prefix/postfix increment or23 decrement operators on pointers. Default is ``false``.24