xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/readability/delete-null-pointer.rst (revision 6e566bc5523f743bc34a7e26f050f1f2b4d699a8)
1.. title:: clang-tidy - readability-delete-null-pointer
2
3readability-delete-null-pointer
4===============================
5
6Checks the ``if`` statements where a pointer's existence is checked and then deletes the pointer.
7The check is unnecessary as deleting a null pointer has no effect.
8
9.. code:: c++
10
11  int *p;
12  if (p)
13    delete p;
14