[Documentation] Fix style of Clang-tidy readability-non-const-parameter.
llvm-svn: 279541
This commit is contained in:
parent
b612ac3775
commit
29da951a3a
|
@ -6,16 +6,19 @@ readability-non-const-parameter
|
||||||
The check finds function parameters of a pointer type that could be changed to
|
The check finds function parameters of a pointer type that could be changed to
|
||||||
point to a constant type instead.
|
point to a constant type instead.
|
||||||
|
|
||||||
When const is used properly, many mistakes can be avoided. Advantages when using
|
When ``const`` is used properly, many mistakes can be avoided. Advantages when
|
||||||
const properly:
|
using ``const`` properly:
|
||||||
* prevent unintentional modification of data
|
|
||||||
* get additional warnings such as using uninitialized data
|
- prevent unintentional modification of data;
|
||||||
* make it easier for developers to see possible side effects
|
|
||||||
|
- get additional warnings such as using uninitialized data;
|
||||||
|
|
||||||
|
- make it easier for developers to see possible side effects.
|
||||||
|
|
||||||
This check is not strict about constness, it only warns when the constness will
|
This check is not strict about constness, it only warns when the constness will
|
||||||
make the function interface safer.
|
make the function interface safer.
|
||||||
|
|
||||||
.. code:: c++
|
.. code-block:: c++
|
||||||
|
|
||||||
// warning here; the declaration "const char *p" would make the function
|
// warning here; the declaration "const char *p" would make the function
|
||||||
// interface safer.
|
// interface safer.
|
||||||
|
@ -41,4 +44,3 @@ make the function interface safer.
|
||||||
int f3(struct S *p) {
|
int f3(struct S *p) {
|
||||||
*(p->a) = 0;
|
*(p->a) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue