CodeCheck Documentation
CodeCheck Documentation - MISRA C++ 2023

Standard: MISRA C++ 2023

The The Motor Industry Software Reliability Association (MISRA) guidelines for C++ published in 2023

MISRA Mission Statement:

We provide world-leading, best practice guidelines for the safe and secure application of both embedded control systems and standalone software.

MISRA is a collaboration between manufacturers, component suppliers and engineering consultancies which seeks to promote best practice in developing safety and security-related electronic systems and other software-intensive applications. To this end, MISRA publishes documents that provide accessible information for engineers and management, and holds events to permit the exchange of experiences between practitioners

www.misra.org.uk

Copyright© 2023 The MISRA Consortium Limited

All RulesAdvisory RulesMandatory RulesRequired Rules
Understand % Coverage94%95%100%94%
Understand Coverage12735389
Total Rules13537395
Check IDCheck NameSupportedCategory
MISRA23_0.0.10.0.1 A function shall not contain unreachable statementsYesRequired
MISRA23_0.0.20.0.2 Controlling expressions should not be invariantNoRequired
MISRA23_0.1.20.1.2 The value returned by a function shall be usedYesRequired
MISRA23_0.2.10.2.1 Variables with limited visibility should be used at least onceYesAdvisory
MISRA23_0.2.20.2.2 A named function parameter shall be used at least onceYesRequired
MISRA23_0.2.30.2.3 Types with limited visibility should be used at least onceYesAdvisory
MISRA23_0.2.40.2.4 Functions with limited visibility should be used at least onceYesAdvisory
MISRA23_4.1.14.1.1 A program shall conform to ISO/IEC 14882:2017 (C++17)NoRequired
MISRA23_4.1.24.1.2 Deprecated features should not be usedNoAdvisory
MISRA23_4.1.34.1.3 There shall be no occurrence of undefined or critical unspecified behaviourNoRequired
MISRA23_5.0.15.0.1 Trigraph-like sequences should not be usedYesRequired
MISRA23_5.7.15.7.1 The character sequence /* shall not be used within a C-style commentYesRequired
MISRA23_5.7.25.7.2 Sections of code should not be "commented out"YesAdvisory
MISRA23_5.7.35.7.3 Line-splicing shall not be used in // commentsYesRequired
MISRA23_5.13.15.13.1 Within character literals and non raw-string literals, \ shall only be used to form a defined escape sequence or universal character nameYesRequired
MISRA23_5.13.25.13.2 Octal escape sequences, hexadecimal escape sequences and universal character names shall be terminatedYesRequired
MISRA23_5.13.35.13.3 Octal constants shall not be usedYesRequired
MISRA23_5.13.45.13.4 Unsigned integer literals shall be appropriately suffixedYesRequired
MISRA23_5.13.55.13.5 The lowercase form of L shall not be used as the first character in a literal suffixYesRequired
MISRA23_5.13.65.13.6 An integer-literal of type long long shall not use a single L or l in any suffixYesRequired
MISRA23_5.13.75.13.7 String literals with different encoding prefixes shall not be concatenatedYesRequired
MISRA23_6.0.16.0.1 Block scope declarations shall not be visually ambiguousYesRequired
MISRA23_6.0.26.0.2 When an array with external linkage is declared, its size should be explicitly specifiedYesAdvisory
MISRA23_6.0.36.0.3 Global Namespace DeclarationsYesRequired
MISRA23_6.0.46.0.4 The identifier main shall not be used for a function other than the global function mainYesRequired
MISRA23_6.2.46.2.4 A header file shall not contain definitions of functions or objects that are non-inline and have external linkageYesRequired
MISRA23_6.4.26.4.2 Derived classes shall not conceal functions that are inherited from their basesYesRequired
MISRA23_6.5.16.5.1 A function or object with external linkage should be introduced in a header fileYesAdvisory
MISRA23_6.5.26.5.2 Internal linkage should be specified appropriatelyYesAdvisory
MISRA23_6.7.16.7.1 Local variables shall not have static storage durationYesRequired
MISRA23_6.7.26.7.2 Global variables shall not be usedYesRequired
MISRA23_6.8.16.8.1 An object shall not be accessed outside of its lifetimeNoRequired
MISRA23_6.8.26.8.2 A function must not return a reference or a pointer to a local variable with automatic storage durationYesMandatory
MISRA23_6.9.16.9.1 The same type aliases shall be used in all declarations of the same entityYesRequired
MISRA23_6.9.26.9.2 The names of the standard signed integer types and standard unsigned integer types should not be usedYesAdvisory
MISRA23_7.0.17.0.1 There shall be no conversion from type boolYesRequired
MISRA23_7.0.37.0.3 The numerical value of a character shall not be usedYesRequired
MISRA23_7.11.17.11.1 nullptr shall be the only form of the null-pointer-constantYesRequired
MISRA23_7.11.27.11.2 Array to Pointer DecayYesRequired
MISRA23_8.1.18.1.1 A non-transient lambda shall not implicitly capture thisYesRequired
MISRA23_8.1.28.1.2 Variables should be captured explicitly in a non-transient lambdaYesAdvisory
MISRA23_8.2.18.2.1 A virtual base class shall only be cast to a derived class by means of dynamic_castYesRequired
MISRA23_8.2.38.2.3 A cast shall not remove any const or volatile qualification from the type accessed via a pointer or by referenceYesRequired
MISRA23_8.2.58.2.5 reinterpret_cast shall not be usedYesRequired
MISRA23_8.2.68.2.6 An object with integral, enumerated, or pointer to void type shall not be cast to a pointer typeYesRequired
MISRA23_8.2.78.2.7 Pointer to Integer CastYesAdvisory
MISRA23_8.2.88.2.8 An object pointer type shall not be cast to an integral type other than std::uintptr_t or std::intptr_tYesRequired
MISRA23_8.2.98.2.9 The operand to typeid shall not be an expression of polymorphic class typeYesRequired
MISRA23_8.2.108.2.10 Functions shall not call themselves, either directly or indirectlyYesRequired
MISRA23_8.3.18.3.1 The built-in unary - operator should not be applied to an expression of unsigned typeYesAdvisory
MISRA23_8.3.28.3.2 The built-in unary + operator should not be usedYesAdvisory
MISRA23_8.7.28.7.2 Subtraction between pointers shall only be applied to pointers that address elements of the same arrayYesRequired
MISRA23_8.14.18.14.1 The right-hand operand of a logical && or || operator should not contain persistent side effectsYesAdvisory
MISRA23_8.18.28.18.2 The result of an assignment operator should not be usedNoAdvisory
MISRA23_8.19.18.19.1 The comma operator shall not be used.YesAdvisory
MISRA23_9.3.19.3.1 The body of an iteration-statement or a selection-statement shall be acompound-statement
YesRequired
MISRA23_9.4.19.4.1 All if ... else if constructs shall be terminated with an else statementYesRequired
MISRA23_9.5.29.5.2 A for-range-initializer shall contain at most one function callYesRequired
MISRA23_9.6.19.6.1 The goto statement should not be usedYesAdvisory
MISRA23_9.6.29.6.2 A goto statement shall reference a label in a surrounding blockYesRequired
MISRA23_9.6.39.6.3 The goto statement shall jump to a label declared later in the function bodyYesRequired
MISRA23_9.6.49.6.4 A function declared with the [[noreturn]] attribute shall not returnYesRequired
MISRA23_9.6.59.6.5 A function with non-void return type shall return a value on all pathsYesRequired
MISRA23_10.0.110.0.1 A declaration should not declare more than one variable or member variableYesAdvisory
MISRA23_10.1.110.1.1 The target type of a pointer or lvalue reference parameter should be const-qualified appropriatelyYesAdvisory
MISRA23_10.1.210.1.2 The volatile qualifier shall be used appropriatelyYesRequired
MISRA23_10.2.110.2.1 An enumeration shall be defined with an explicit underlying typeYesRequired
MISRA23_10.2.210.2.2 Unscoped enumerations should not be declaredYesAdvisory
MISRA23_10.3.110.3.1 There should be no unnamed namespaces in header filesYesAdvisory
MISRA23_10.4.110.4.1 The asm declaration shall not be usedYesRequired
MISRA23_11.3.111.3.1 Variables of array type should not be declaredYesAdvisory
MISRA23_11.3.211.3.2 The declaration of an object should contain no more than two levels of pointer indirectionYesAdvisory
MISRA23_11.6.111.6.1 All variables should be initializedYesAdvisory
MISRA23_11.6.311.6.3 Within an enumerator list, the value of an implicitly-specified
enumeration constant shall be unique
YesRequired
MISRA23_12.2.112.2.1 Bit-fields should not be declaredYesAdvisory
MISRA23_12.2.212.2.2 A bit-field shall have an appropriate typeYesRequired
MISRA23_12.2.312.2.3 A named bit-field with signed integer type shall not have a length of one bitYesRequired
MISRA23_12.3.112.3.1 The union keyword shall not be usedYesRequired
MISRA23_13.1.113.1.1 Classes should not be inherited virtuallyYesAdvisory
MISRA23_13.1.213.1.2 An accessible base class shall not be both virtual and non-virtual in the same hierarchyYesRequired
MISRA23_13.3.113.3.1 User-declared member functions shall use the virtual, override and final specifiers appropriatelyYesRequired
MISRA23_13.3.213.3.2 Parameters in an overriding virtual function shall not specify different default argumentsYesRequired
MISRA23_13.3.313.3.3 The parameters in all declarations or overrides of a function shall either be unnamed or have identical namesYesRequired
MISRA23_14.1.114.1.1 Non-static data members should be either all private or all publicYesAdvisory
MISRA23_15.0.215.0.2 User-provided copy and move member functions of a class should have appropriate signaturesYesAdvisory
MISRA23_15.1.115.1.1 An object's dynamic type shall not be used from within its constructor or destructorYesRequired
MISRA23_15.1.315.1.3 Conversion operators and constructors that are callable with a single argument shall be explicitYesRequired
MISRA23_15.1.515.1.5 A class shall only define an initializer-list constructor when it is the only constructorYesRequired
MISRA23_16.5.116.5.1 The logical AND and logical OR operators shall not be overloadedYesRequired
MISRA23_16.5.216.5.2 The address-of operator shall not be overloadedYesRequired
MISRA23_16.6.116.6.1 Symmetrical operators should only be implemented as non-member functionsYesAdvisory
MISRA23_17.8.117.8.1 Function templates shall not be explicitly specializedYesRequired
MISRA23_18.1.118.1.1 An exception object shall not have pointer typeYesRequired
MISRA23_18.1.218.1.2 An empty throw shall only occur within the compound-statement of a catch handlerYesRequired
MISRA23_18.3.118.3.1 There should be at least one exception handler to catch all otherwise unhandled exceptionsYesAdvisory
MISRA23_18.3.218.3.2 An exception of class type shall be caught by const reference or referenceYesRequired
MISRA23_18.3.318.3.3 Handlers for a function-try-block of a constructor or destructor shall not refer to non-static members from their class or its basesYesRequired
MISRA23_18.5.218.5.2 Program-terminating functions should not be usedYesAdvisory
MISRA23_19.0.119.0.1 A line whose first token is # shall be a valid preprocessing directiveYesRequired
MISRA23_19.0.219.0.2 Function-like macros shall not be definedYesRequired
MISRA23_19.0.419.0.4 #undef should only be used for macros defined previously in the same fileYesAdvisory
MISRA23_19.1.119.1.1 The defined preprocessor operator shall be used appropriatelyYesRequired
MISRA23_19.1.219.1.2 All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are relatedYesRequired
MISRA23_19.1.319.1.3 All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be defined prior to evaluationNoRequired
MISRA23_19.2.119.2.1 Precautions shall be taken in order to prevent the contents of a header file being included more than onceYesRequired
MISRA23_19.2.219.2.2 The #include directive shall be followed by either a <filename> or "filename" sequenceYesRequired
MISRA23_19.2.319.2.3 The ' or " or \ characters and the /* or // character sequences shall not occur in a header file nameYesRequired
MISRA23_19.3.119.3.1 The # and ## operators should not be usedYesAdvisory
MISRA23_19.3.219.3.2 A macro parameter immediately following a # operator shall not immediately be followed by a ## operatorYesRequired
MISRA23_19.3.319.3.3 The argument to a mixed-use macro parameter shall not be subject to further expansionNoRequired
MISRA23_19.3.419.3.4 Parentheses shall be used to ensure macro arguments are expanded appropriatelyYesRequired
MISRA23_19.3.519.3.5 Tokens that look like a preprocessing directive shall not occur within a macro argumentYesAdvisory
MISRA23_19.6.119.6.1 The #pragma directive and the _Pragma operator should not be usedYesAdvisory
MISRA23_21.2.121.2.1 The library functions atof, atoi, atol and atoll from library <cstdlib> shall not be usedYesRequired
MISRA23_21.2.221.2.2 The string handling functions from <cstring>, <cstdlib>, <cwchar> and <cinttypes> shall not be usedYesRequired
MISRA23_21.2.321.2.3 The library function system from <cstdlib> shall not be usedYesRequired
MISRA23_21.2.421.2.4 The macro offsetof shall not be usedYesRequired
MISRA23_21.6.121.6.1 Dynamic memory should not be usedYesAdvisory
MISRA23_21.6.221.6.2 Dynamic memory shall be managed automaticallyYesRequired
MISRA23_21.6.421.6.4 If a project defines either a sized or unsized version of a global operator delete, then both shall be definedYesRequired
MISRA23_21.6.521.6.5 A pointer to an incomplete class type shall not be deletedYesRequired
MISRA23_21.10.121.10.1 The features of <cstdarg> shall not be usedYesRequired
MISRA23_21.10.221.10.2 The standard header file <csetjmp> shall not be usedYesRequired
MISRA23_21.20.321.20.3 The facilities provided by the standard header file <csignal> shall not be usedYesRequired
MISRA23_22.3.122.3.1 The assert macro shall not be used with a constant-expressionYesRequired
MISRA23_22.4.122.4.1 The literal value zero shall be the only value assigned to errnoYesRequired
MISRA23_24.5.124.5.1 The character handling functions from <cctype> and <cwctype> shall not be usedYesRequired
MISRA23_24.5.224.5.2 The C++ Standard Library functions memcpy, memmove and memcmp from <cstring> shall not be usedYesRequired
MISRA23_25.5.125.5.1 The setlocale and std::locale::global functions shall not be calledYesRequired
MISRA23_25.5.225.5.2 The pointers returned by the C++ Standard Library functions localeconv, getenv, setlocale or strerror must only be used as if they have pointer to const-qualified typeYesMandatory
MISRA23_25.5.325.5.3 The pointer returned by the C++ Standard Library functions asctime, ctime, gmtime, localtime, localeconv, getenv, setlocale or strerror must not be used following a subsequent call to the same functionYesMandatory
MISRA23_26.3.126.3.1 std::vector should not be specialized with boolYesAdvisory
MISRA23_28.6.128.6.1 The argument to std::move shall be a non-const lvalueYesRequired
MISRA23_30.0.130.0.1 The C Library input/output functions shall not be usedYesRequired
MISRA23_30.0.230.0.2 Reads and writes on the same file stream shall be separated by a positioning operationYesRequired