C26496 USE_CONST_FOR_VARIABLEC26496 USE_CONST_FOR_VARIABLE
Переменная "переменная" назначается только один раз, пометьте ее как
const
.The variable 'variable' is assigned only once, mark it asconst
.
См. также разделSee also
C++ Core Guidelines Con. 4.C++ Core Guidelines con.4.
ПримерExample
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);
// ...
}