Udostępnij za pośrednictwem


Ostrzeżenie C26497

Ta nazwa funkcji może być oznaczonaconstexpr, jeśli wymagana jest ocena czasu kompilacji (f.4).

Zobacz też

Podstawowe wytyczne języka C++ F.4.

Przykład

const int GetTheAnswer(int x) noexcept { return 42 + x; } // Could be marked constexpr

void function1() noexcept
{
    const int theAnswer = GetTheAnswer(0);
}

Aby zmniejszyć szum analizy kodu dla nowego kodu, to ostrzeżenie nie jest wystawiane, jeśli funkcja ma pustą implementację.

int function1(){  // no C26497
    return 1;
}
void function2(){} // no C26497