Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 641 Bytes

File metadata and controls

26 lines (20 loc) · 641 Bytes
title C26497
ms.date 03/22/2018
ms.topic reference
f1_keywords
C26497
helpviewer_keywords
C26497
description CppCoreCheck rule that enforces C++ Core Guidelines F.4

C26497 USE_CONSTEXPR_FOR_FUNCTION

This function %function% could be marked constexpr if compile-time evaluation is desired (f.4).

See also

C++ Core Guidelines F.4.

Example

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

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