| 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" profile of the C++ Core Guidelines, see |
| 14 |
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arithmetic. |