Freigeben über


Warnung C26496

Die Variable 'Variable' wird nur einmal zugewiesen, und sie wird als const.

Siehe auch

C++ Core Guidelines con.4.

Beispiel

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);
    // ...
}