| title |
Warning C26496 |
| ms.date |
03/22/2018 |
| f1_keywords |
C26496 |
USE_CONST_FOR_VARIABLE |
|
| helpviewer_keywords |
|
| description |
CppCoreCheck rule C26496 that enforces C++ Core Guidelines Con.4 |
The variable 'variable' is assigned only once, mark it as const.
C++ Core Guidelines con.4.
int GetTheNumber();
int GiveMeTheNumber(int);
void function1()
{
int theNumber = GetTheNumber(); // C26496, 'theNumber' is never assigned to again, so it can be marked as const
std::cout << theNumber << '\n';
GiveMeTheNumber(theNumber);
// ...
}