mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 04:44:34 +03:00
Updated Con.1 to make one function a definition, closes #1785
Also fixed "arguments" -> "parameters"
This commit is contained in:
@@ -16540,13 +16540,13 @@ Prevents accidental or hard-to-notice change of value.
|
|||||||
|
|
||||||
##### Exception
|
##### Exception
|
||||||
|
|
||||||
Function arguments are rarely mutated, but also rarely declared const.
|
Function parameters passed by value are rarely mutated, but also rarely declared `const`.
|
||||||
To avoid confusion and lots of false positives, don't enforce this rule for function arguments.
|
To avoid confusion and lots of false positives, don't enforce this rule for function parameters.
|
||||||
|
|
||||||
void f(const char* const p); // pedantic
|
void f(const char* const p); // pedantic
|
||||||
void g(const int i); // pedantic
|
void g(const int i) { ... } // pedantic
|
||||||
|
|
||||||
Note that function parameter is a local variable so changes to it are local.
|
Note that a function parameter is a local variable so changes to it are local.
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user