Skip to content

Commit 47a40e8

Browse files
authored
Fix #41439: Update the documentation with the correct information. (#69377)
Fixes #41439 The documentation is update to say it is allowed to have omitted parameter names if the variable is not used
1 parent 901e484 commit 47a40e8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

clang-tools-extra/docs/clang-tidy/checks/readability/named-parameter.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ Guide:
1010

1111
https://google.github.io/styleguide/cppguide.html#Function_Declarations_and_Definitions
1212

13-
All parameters should be named, with identical names in the declaration and
14-
implementation.
13+
All parameters should have the same name in both the function declaration and definition.
14+
If a parameter is not utilized, its name can be commented out in a function definition.
15+
16+
.. code-block:: c++
17+
18+
int doingSomething(int a, int b, int c);
19+
20+
int doingSomething(int a, int b, int /*c*/) {
21+
// Ok: the third param is not used
22+
return a + b;
23+
}
1524

1625
Corresponding cpplint.py check name: `readability/function`.

0 commit comments

Comments
 (0)