Napomena
Za pristup ovoj stranici potrebna je autorizacija. Možete se pokušati prijaviti ili promijeniti direktorije.
Za pristup ovoj stranici potrebna je autorizacija. Možete pokušati promijeniti direktorije.
The const variable 'variable' can be computed at compile time. Consider using
constexpr(con.5)
Remarks
Use constexpr for constants whose value is known at compile time. (Con.5)
Code analysis name: USE_CONSTEXPR_RATHER_THAN_CONST
Example
const int foo = 1234; // C26814 reported here.
constexpr int getMagicNumber()
{
return 42;
}
void bar()
{
const int myval = 3; // C26814 reported here
const int magicNumber = getMagicNumber(); // C26814 reported here.
}
See also
Con.5 Use constexpr for all variables that can be computed at compile time