title | ms.date | f1_keywords | helpviewer_keywords | description | |||
---|---|---|---|---|---|---|---|
Warning C26496 |
03/22/2018 |
|
|
CppCoreCheck rule C26496 that enforces C++ Core Guidelines Con.4 |
The variable 'variable' is assigned only once, mark it as
const
.
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);
// ...
}