Bagikan melalui


Peringatan C26496

Variabel 'variabel' hanya ditetapkan sekali, tandai sebagai const.

Lihat juga

C++ Panduan Inti con.4.

Contoh

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