Nota
L-aċċess għal din il-paġna jeħtieġ l-awtorizzazzjoni. Tista’ tipprova tidħol jew tibdel id-direttorji.
L-aċċess għal din il-paġna jeħtieġ l-awtorizzazzjoni. Tista’ tipprova tibdel id-direttorji.
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