Get Started
- CodeAnt AI
- Control Center
- Pull Request Review
- IDE
- Compliance
- Anti-Patterns
- Code Governance
- Infrastructure Security Database
- Application Security Database
MISRA-CPP-2023
Sections of code should not be “commented out”.
A function shall not contain unreachable statements.
Controlling expressions should not be invariant.
A value should not be unnecessarily written to a local object.
The value returned by a function shall be used.
Variables with limited visibility should be used at least once.
A named function parameter shall be used at least once.
Types with limited visibility should be used at least once.
Functions with limited visibility should be used at least once.
A program shall conform to ISO/IEC 14882:2017 (C++17).
Deprecated features should not be used.
Deprecated features should not be used.
Operations on a memory location shall be sequenced appropriately.
Trigraph-like sequences should not be used.
The character sequence /* shall not be used within a C-style comment.
Line-splicing shall not be used in // comments.
User-defined identifiers shall have an appropriate form.
Within character literals and non raw-string literals,\ shall only be used form a defined escape sequence or universal character name.
Octal escape sequences, hexadecimal escape sequences and universal character names shall be terminated.
Octal constants shall not be used.
Unsigned integer literals shall be appropriately suffixed.
The lowercase form of L shall not be used as the first character in a literal suffix.
An integer-literal of type long long shall not use a single L or l in any suffix.
String literals with different encoding prefixes shall not be concatenated.
Block scope declarations shall not be visually ambiguous.
When an array with external linkage is declared, its size should be explicitly specified.
The only declarations in the global namespace should be main, namespace declarations and extern “C” declarations.
The identifier main shall not be used for a function other than the global function main.
The one-definition rule shall not be violated.
All declarations of a variable or function shall have the same type.
The source code used to implement an entity shall appear only once.
A header file shall not contain definitions of functions or objects that are non-inline and have external linkage.
A variable declared in an inner scope shall not hide a variable declared in an outer scope.
Derived classes shall not conceal functions that are inherited from their bases.
A name that is present in a dependent base shall not be resolved by unqualified lookup.
A function or object with external linkage should be introduced in a header file.
Internal linkage should be specified appropriately.
Local variables shall not have static storage duration.
Global variables shall not be used.
An object shall not be accessed outside of its lifetime.
A function must not return a reference or a pointer to a local variable with automatic storage duration.
An assignment operator shall not assign the address of an object with automatic storage duration to an object with a greater lifetime.
Member functions returning references to their object should be ref-qualified appropriately.
The same type aliases shall be used in all declarations of the same entity.
The names of the standard signed integer types and standard unsigned integer types should not be used.
There shall be no conversion from type bool.
There shall be no conversion to type bool.
The numerical value of a character shall not be used.
The operands of bitwise operators and shift operators shall be appropriate.
Integral promotion and the usual arithmetic conversions shall not change the signedness or the type category of an operand.
Assignment between numeric types shall be appropriate.
nullptr shall be the only form of the null-pointer-constant.
An array passed as a function argument shall not decay to a pointer.
A conversion from function type to pointer-to-function type shall only occur in appropriate contexts.
Parentheses should be used to make the meaning of an expression appropriately explicit.
A non-transient lambda shall not implicitly capture this.
Variables should be captured explicitly in a non-transient lambda.
A virtual base class shall only be cast to a derived class by means of dynamic_cast.
C-style casts and functional notation casts shall not be used.
A cast shall not remove any const or volatile qualification from the type accessed via a pointer or by reference.
Casts shall not be performed between a pointer to a function and any other type.
reinterpret_cast shall not be used.
An object with integral, enumerated, or pointer to void type shall not be cast to a pointer type.
A cast should not convert a pointer type to an integral type.
An object pointer type shall not be cast to an integral type other than std::uintptr_t or std::intptr_t.
The operand to typeid shall not be an expression of polymorphic class type.
Functions shall not call themselves, either directly or indirectly.
An argument passed via ellipsis shall have an appropriate type.
The built-in unary - operator should not be applied to an expression of unsigned type.
The built-in unary + operator should not be used.
Pointer arithmetic shall not form an invalid pointer.
Subtraction between pointers shall only be applied to pointers that address elements of the same array.
The built-in realational operators shall not be applied to objects of pointer type, except where they point to elements of the same array.
The right hand operand of a logical && or || operator should not contain persistent side effects.
An object or subobject must not be copied to an overlapping object.
The result of an assignment operator should not be used.
The comma operator should not be used.
An unsigned arithmetic operation with constant operands should not wrap.
An explicit type conversion shall not be an expression statement.
The body of an iteration-statement or a selection-statement shall be a compound-statement.
All if … else if constructs shall be terminated with an else statement.
The structure of a switch statement shall be appropriate.
Legacy for statements should be simple.
A for-range-initializer shall contain at most one function call.
The goto statement should not be used.
A goto statement shall reference a label in a surrounding block.
The goto statement shall jump to a label declared later in the function body.
A function declared with the [[noreturn]] attribute shall not return.
A function with non-void return type shall return a value on all paths.
A declaration should not declare more than one variable or member variable.
The target type of a pointer or lvalue reference parameter should be const-qualified appropriately.
The volatile qualifier shall be used appropriately.
An enumeration shall be defined with an explicit underlying type.
Unscoped enumerations should not be declared.
The numerical value of unscoped enumeration with no fixed underlying type shall not be used.
There should be no unnamed namespaces in header files.
The asm declaration shall not be used.
Variables of array type should not be declared.
The declaration of an object should contain no more than two levels of pointer indirection.
All variables should be initialized.
The value of an object must not be read before it has been set.
Within an enumerator list, the value of an implicitly-specified enumeration constant shall be unique.
Bit-fields should not be declared.
A bit-field shall have an appropriate type.
A named bit-field with signed integer type shall not have a length of one bit.
The union keyword shall not be used.
Classes should not be inherited virtually.
An accessible base class shall not be both virtual and non-virtual in the same hierarchy.
User-declared member functions shall use the virtual, override, and final specifiers appropriately.
Parameters in an overriding virtual function shall not specify different default arguments.
The parameters in all declarations or overrides of a function shall either be unnamed or have identical names.
A comparison of a potentially virtual pointer to member function shall only be with nullptr.
Non-static data members should be either all private or all public.
Special member functions shall be provided appropriately.
User-provided copy and move member functions of a class should have appropriate signatures.
An object’s dynamic type shall not be used from within its constructor or destructor.
All constructor of a class should explicitly initialize all of its virtual base classes and immediate base classes.
Conversion operators and constructors that are callable with a single argument shall be explicit.
All direct, non-static data members of a class should be initialized before the class object is accessible.
A class shall only define an initializer-list constructor when it is the only constructor.
The logical AND and logical OR operators shall not be overloaded.
The address-of operator shall not be overloaded.
Symmetrical operators should only be implemented as non-member functions.
Function templates shall not be explicitly specialized.
An exception object shall not have pointer type.
An empty throw shall only occur within the compound-statement of a catch handler.
There should be at least one exception handler to catch all otherwise unhandled exceptions.
An exception of class type shall be caught by const reference or reference.
Handlers for a function-try-block of a constructor or destructor shall not refer to non-static members from their class or its bases.
Exception-unfriendly functions shall be noexcept.
A noexcept function should not attempt to propagate an exception to the calling function.
Program-terminating functions should not be used.
A line whose first token is # shall be a valid preprocessing directive.
Function-like macros shall not be defined.
#include directives should only be preceded by preprocessor directives or comments.
#undef should only be used for macros defined previously in the same file.
The defined preprocessor operator shall be used appropriately.
The defined preprocessor operator shall be used appropriately.
All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be defined prior to evaluation.
Precautions shall be taken in order to prevent the contents of a header file being included more than once.
The #include directive shall be followed by either a or “filename” sequence.
The ’ or ” or \ characters and the /* or // character sequences shall not occur in a header file name.
The # and ## preprocessor operators should not be used.
A macro parameter immediately following a # operator shall not be immediately followed by a ## operator.
The argument to a mixed-use macro parameter shall not be subject to further expansion.
Parentheses shall be used to ensure macro arguments are expanded appropriately.
Tokens that look like a preprocessing directive shall not occur within a macro argument.
The #pragma directive and the _Pragma operator should not be used.
The library functions atof, atoi, atol and atoll from shall not be used.
The string handling functions from , , and shall not be used.
The library function system from shall not be used.
The macro offsetof shall not be used.
Dynamic memory should not be used.
Dynamic memory shall be managed automatically.
Advanced memory management shall not be used.
If a project defines either a sized or unsized version of a global operator delete, then both shall be defined.
A pointer to an incomplete class type shall not be deleted.
The features of shall not be used.
The standard header file shall not be used.
The facilities provided by the standard header file shall not be used.
The assert macro shall not be used with a constant-expression.
The literal value zero shall be the only value assigned to errno.
The raw pointer constructors of std::shared_ptr and std::unique_ptr should not be used.
The character handling function from and shall not be used.
The C++ standard library function memcpy, memmove and memcpy from shall not be used.
The setlocale and std::locale::global functions shall not be called.
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 type.
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 function.
std::vector should not be specialized with bool.
Predicates shall not have persistent side effects.
The argument to std::move shall be a non-const lvalue.
Forwarding references and std::forward shall be used together.
An object shall not be used while in a potentially moved-from state.
The result of std::remove, std::remove_if, std::unique and empty shall be used.
The C Library input/output functions shall not be used.
Reads and writes on the same file stream shall be separated by positioning operation.