Main Content

Bug Finder Results Found in Fast Analysis Mode

In fast analysis mode, Bug Finder checks for a subset of defects and coding rules. The tables below list the results that can be found in a fast analysis. See also Use fast analysis mode for Bug Finder (-fast-analysis).

These defects and coding standard violations are either found earlier in the analysis or leverage archived information from a previous analysis. The analysis results are comparatively easier to review and fix because most results can be understood by focusing on two or three lines of code (the line with the defect and one or two previous lines).

Because of the simplified nature of the analysis, you might see fewer defects in the fast analysis mode compared to a regular Bug Finder analysis.

Polyspace Bug Finder Defects

Static Memory

NameDescription
Buffer overflow from incorrect string format specifier
(str_format_buffer_overflow)

String format specifier causes buffer argument of standard library functions to overflow

Unreliable cast of function pointer
(func_cast)

Function pointer cast to another function pointer with different argument or return type

Unreliable cast of pointer
(ptr_cast)

Pointer implicitly cast to different data type

Programming

NameDescription
Copy of overlapping memory
(overlapping_copy)

Source and destination arguments of a copy function have overlapping memory

Exception caught by value
(excp_caught_by_value)

catch statement accepts an object by value

Exception handler hidden by previous handler
(excp_handler_hidden)

catch statement is not reached because of an earlier catch statement for the same exception

Format string specifiers and arguments mismatch
(string_format)

String specifiers do not match corresponding arguments

Improper array initialization
(improper_array_init)

Incorrect array initialization when using initializers

Invalid use of == operator
(bad_equal_equal_use)

Equality operation in assignment statement

Invalid use of = operator
(bad_equal_use)

Assignment in conditional statement

Invalid use of floating point operation
(bad_float_op)

Imprecise comparison of floating point variables

Missing null in string array
(missing_null_char)

String does not terminate with null character

Overlapping assignment
(overlapping_assign)

Memory overlap between left and right sides of an assignment

Possibly unintended evaluation of expression because of operator precedence rules
(operator_precedence)

Operator precedence rules cause unexpected evaluation order in arithmetic expression

Unsafe conversion between pointer and integer
(bad_int_ptr_cast)

Misaligned or invalid results from conversions between pointer and integer types

Wrong type used in sizeof
(ptr_sizeof_mismatch)

sizeof argument does not match pointed type

Data Flow

NameDescription
Code deactivated by constant false condition
(deactivated_code)

Code segment deactivated by #if 0 directive or if(0) condition

Missing return statement
(missing_return)

Function does not return value though return type is not void

Static uncalled function
(uncalled_func)

Function with static scope not called in file

Variable shadowing
(var_shadowing)

Variable hides another variable of same name with nested scope

Object Oriented

NameDescription
*this not returned in copy assignment operator
(return_not_ref_to_this)

operator= method does not return a pointer to the current object

Base class assignment operator not called
(missing_base_assign_op_call)

Copy assignment operator does not call copy assignment operators of base subobjects

Base class destructor not virtual
(dtor_not_virtual)

Class cannot behave polymorphically for deletion of derived class objects

Copy constructor not called in initialization list
(missing_copy_ctor_call)

Copy constructor does not call copy constructors of some members or base classes

Incompatible types prevent overriding
(virtual_func_hiding)

Derived class method hides a virtual base class method instead of overriding it

Member not initialized in constructor
(non_init_member)

Constructor does not initialize some members of a class

Missing explicit keyword
(missing_explicit_keyword)

Constructor missing the explicit specifier

Missing virtual inheritance
(missing_virtual_inheritance)

A base class is inherited virtually and nonvirtually in the same hierarchy

Object slicing
(object_slicing)

Derived class object passed by value to function with base class parameter

Partial override of overloaded virtual functions
(partial_override)

Class overrides fraction of inherited virtual functions with a given name

Return of non const handle to encapsulated data member
(breaking_data_encapsulation)

Method returns pointer or reference to internal member of object

Self assignment not tested in operator
(missing_self_assign_test)

Copy assignment operator does not test for self-assignment

Security

NameDescription
Function pointer assigned with absolute address
(func_ptr_absolute_addr)

Constant expression is used as function address is vulnerable to code injection

Good Practice

NameDescription
Bitwise and arithmetic operation on the same data
(bitwise_arith_mix)

Statement with mixed bitwise and arithmetic operations

Delete of void pointer
(delete_of_void_ptr)

delete operates on a void* pointer pointing to an object

Hard-coded buffer size
(hard_coded_buffer_size)

Size of memory buffer is a numerical value instead of symbolic constant

Hard-coded loop boundary
(hard_coded_loop_boundary)

Loop boundary is a numerical value instead of symbolic constant

Large pass-by-value argument
(pass_by_value)

Large argument passed by value between functions

Line with more than one statement
(more_than_one_statement)

Multiple statements on a line

Missing break of switch case
(missing_switch_break)

No comments at the end of switch case without a break statement

Missing reset of a freed pointer
(missing_freed_ptr_reset)

Pointer free not followed by a reset statement to clear leftover data

Unused parameter
(unused_parameter)

Function prototype has parameters not read or written in function body

MISRA C:2004 and MISRA AC AGC Rules

The software checks the following rules early in the analysis.

Language Extensions

RuleDescription
2.1

Assembly language shall be encapsulated and isolated.

2.2

Source code shall only use /* */ style comments.

2.3

The character sequence /* shall not be used within a comment.

Documentation

RuleDescription
3.4

All uses of the #pragma directive shall be documented and explained.

Character Sets

RuleDescription
4.1

Only those escape sequences which are defined in the ISO C standard shall be used.

4.2

Trigraphs shall not be used.

Identifiers

RuleDescription
5.2

Identifiers in an inner scope shall not use the same name as an identifier in an outer scope, and therefore hide that identifier.

Types

RuleDescription
6.1

The plain char type shall be used only for the storage and use of character values.

6.2

Signed and unsigned char type shall be used only for the storage and use of numeric values.

6.3

typedefs that indicate size and signedness should be used in place of the basic types.

6.4

Bit fields shall only be defined to be of type unsigned int or signed int.

6.5

Bit fields of type signed int shall be at least 2 bits long.

Constants

RuleDescription
7.1

Octal constants (other than zero) and octal escape sequences shall not be used.

Declarations and Definitions

RuleDescription
8.1

Functions shall have prototype declarations and the prototype shall be visible at both the function definition and call.

8.2

Whenever an object or function is declared or defined, its type shall be explicitly stated.

8.3

For each function parameter the type given in the declaration and definition shall be identical, and the return types shall also be identical.

8.5

There shall be no definitions of objects or functions in a header file.

8.6

Functions shall always be declared at file scope.

8.7

Objects shall be defined at block scope if they are only accessed from within a single function.

8.8

An external object or function shall be declared in one file and only one file.

8.9

An identifier with external linkage shall have exactly one external definition.

8.11

The static storage class specifier shall be used in definitions and declarations of objects and functions that have internal linkage

8.12

When an array is declared with external linkage, its size shall be stated explicitly or defined implicitly by initialization.

Initialization

RuleDescription
9.2

Braces shall be used to indicate and match the structure in the nonzero initialization of arrays and structures.

9.3

In an enumerator list, the = construct shall not be used to explicitly initialize members other than the first, unless all items are explicitly initialized.

Arithmetic Type Conversion

RuleDescription
10.1

The value of an expression of integer type shall not be implicitly converted to a different underlying type if:

  • It is not a conversion to a wider integer type of the same signedness, or

  • The expression is complex, or

  • The expression is not constant and is a function argument, or

  • The expression is not constant and is a return expression

10.2

The value of an expression of floating type shall not be implicitly converted to a different type if

  • It is not a conversion to a wider floating type, or

  • The expression is complex, or

  • The expression is a function argument, or

  • The expression is a return expression

10.3

The value of a complex expression of integer type may only be cast to a type that is narrower and of the same signedness as the underlying type of the expression.

10.4

The value of a complex expression of float type may only be cast to narrower floating type.

10.5

If the bitwise operator ~ and << are applied to an operand of underlying type unsigned char or unsigned short, the result shall be immediately cast to the underlying type of the operand

10.6

The "U" suffix shall be applied to all constants of unsigned types.

Pointer Type Conversion

RuleDescription
11.1

Conversion shall not be performed between a pointer to a function and any type other than an integral type.

11.2

Conversion shall not be performed between a pointer to an object and any type other than an integral type, another pointer to an object type or a pointer to void.

11.3

A cast should not be performed between a pointer type and an integral type.

11.4

A cast should not be performed between a pointer to object type and a different pointer to object type.

11.5

A cast shall not be performed that removes any const or volatile qualification from the type addressed by a pointer

Expressions

RuleDescription
12.1

Limited dependence should be placed on C's operator precedence rules in expressions.

12.3

The sizeof operator should not be used on expressions that contain side effects.

12.5

The operands of a logical && or || shall be primary-expressions.

12.6

Operands of logical operators (&&, || and !) should be effectively Boolean. Expression that are effectively Boolean should not be used as operands to operators other than (&&, || or !).

12.7

Bitwise operators shall not be applied to operands whose underlying type is signed.

12.9

The unary minus operator shall not be applied to an expression whose underlying type is unsigned.

12.10

The comma operator shall not be used.

12.11

Evaluation of constant unsigned expression should not lead to wraparound.

12.12

The underlying bit representations of floating-point values shall not be used.

12.13

The increment (++) and decrement (--) operators should not be mixed with other operators in an expression

Control Statement Expressions

RuleDescription
13.1

Assignment operators shall not be used in expressions that yield Boolean values.

13.2

Tests of a value against zero should be made explicit, unless the operand is effectively Boolean.

13.3

Floating-point expressions shall not be tested for equality or inequality.

13.4

The controlling expression of a for statement shall not contain any objects of floating type.

13.5

The three expressions of a for statement shall be concerned only with loop control.

13.6

Numeric variables being used within a for loop for iteration counting should not be modified in the body of the loop.

Control Flow

RuleDescription
14.3

All non-null statements shall either

  • have at least one side effect however executed, or

  • cause control flow to change.

14.4

The goto statement shall not be used.

14.5

The continue statement shall not be used.

14.6

For any iteration statement, there shall be at most one break statement used for loop termination.

14.7

A function shall have a single point of exit at the end of the function.

14.8

The statement forming the body of a switch, while, do while or for statement shall be a compound statement.

14.9

An if (expression) construct shall be followed by a compound statement. The else keyword shall be followed by either a compound statement, or another if statement.

14.10

All if else if constructs should contain a final else clause.

Switch Statements

RuleDescription
15.0

Unreachable code is detected between switch statement and first case.

15.1

A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement

15.2

An unconditional break statement shall terminate every non-empty switch clause.

15.3

The final clause of a switch statement shall be the default clause.

15.4

A switch expression should not represent a value that is effectively Boolean.

15.5

Every switch statement shall have at least one case clause.

Functions

RuleDescription
16.1

Functions shall not be defined with variable numbers of arguments.

16.3

Identifiers shall be given for all of the parameters in a function prototype declaration.

16.5

Functions with no parameters shall be declared with parameter type void.

16.6

The number of arguments passed to a function shall match the number of parameters.

16.8

All exit paths from a function with non-void return type shall have an explicit return statement with an expression.

16.9

A function identifier shall only be used with either a preceding &, or with a parenthesized parameter list, which may be empty.

Pointers and Arrays

RuleDescription
17.4

Array indexing shall be the only allowed form of pointer arithmetic.

17.5

A type should not contain more than 2 levels of pointer indirection.

Structures and Unions

RuleDescription
18.1

All structure or union types shall be complete at the end of a translation unit.

18.4

Unions shall not be used.

Preprocessing Directives

RuleDescription
19.1

#include statements in a file shall only be preceded by other preprocessors directives or comments.

19.2

Nonstandard characters should not occur in header file names in #include directives.

19.3

The #include directive shall be followed by either a <filename> or "filename" sequence.

19.4

C macros shall only expand to a braced initializer, a constant, a parenthesized expression, a type qualifier, a storage class specifier, or a do-while-zero construct.

19.5

Macros shall not be #define-d and #undef-d within a block.

19.6

#undef shall not be used.

19.7

A function should be used in preference to a function like-macro.

19.8

A function-like macro shall not be invoked without all of its arguments.

19.9

Arguments to a function-like macro shall not contain tokens that look like preprocessing directives.

19.10

In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses unless it is used as the operand of # or ##.

19.11

All macro identifiers in preprocessor directives shall be defined before use, except in #ifdef and #ifndef preprocessor directives and the defined() operator.

19.12

There shall be at most one occurrence of the # or ## preprocessor operators in a single macro definition.

19.13

The # and ## preprocessor operators should not be used.

19.14

The defined preprocessor operator shall only be used in one of the two standard forms.

19.15

Precautions shall be taken in order to prevent the contents of a header file being included twice.

19.16

Preprocessing directives shall be syntactically meaningful even when excluded by the preprocessor.

19.17

All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if or #ifdef directive to which they are related.

Standard Libraries

RuleDescription
20.1

Reserved identifiers, macros and functions in the standard library, shall not be defined, redefined or undefined.

20.2

The names of standard library macros, objects and functions shall not be reused.

20.4

Dynamic heap memory allocation shall not be used.

20.5

The error indicator errno shall not be used.

20.6

The macro offsetof, in library <stddef.h>, shall not be used.

20.7

The setjmp macro and the longjmp function shall not be used.

20.8

The signal handling facilities of <signal.h> shall not be used.

20.9

The input/output library <stdio.h> shall not be used in production code.

20.10

The library functions atof, atoi and atoll from library <stdlib.h> shall not be used.

20.11

The library functions abort, exit, getenv and system from library <stdlib.h> shall not be used.

20.12

The time handling functions of library <time.h> shall not be used.

MISRA C:2012 Rules

Standard C Environment

RuleDescription
1.1

The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation's translation limits.

1.2

Language extensions should not be used.

Unused Code

RuleDescription
2.6

A function should not contain unused label declarations.

2.7

There should be no unused parameters in functions.

Comments

RuleDescription
3.1

The character sequences /* and // shall not be used within a comment.

3.2

Line-splicing shall not be used in // comments.

Character Sets and Lexical Conventions

RuleDescription
4.1

Octal and hexadecimal escape sequences shall be terminated.

4.2

Trigraphs should not be used.

Identifiers

RuleDescription
5.2

Identifiers declared in the same scope and name space shall be distinct.

5.3

An identifier declared in an inner scope shall not hide an identifier declared in an outer scope.

5.4

Macro identifiers shall be distinct.

5.5

Identifiers shall be distinct from macro names.

Types

RuleDescription
6.1

Bit-fields shall only be declared with an appropriate type.

6.2

Single-bit named bit fields shall not be of a signed type.

Literals and Constants

RuleDescription
7.1

Octal constants shall not be used.

7.2

A "u" or "U" suffix shall be applied to all integer constants that are represented in an unsigned type.

7.3

The lowercase character "l" shall not be used in a literal suffix.

7.4

A string literal shall not be assigned to an object unless the object's type is "pointer to const-qualified char".

Declarations and Definitions

RuleDescription
8.1

Types shall be explicitly specified.

8.2

Function types shall be in prototype form with named parameters.

8.4

A compatible declaration shall be visible when an object or function with external linkage is defined.

8.5An external object or function shall be declared once in one and only one file.
8.6An identifier with external linkage shall have exactly one external definition.
8.8

The static storage class specifier shall be used in all declarations of objects and functions that have internal linkage.

8.10

An inline function shall be declared with the static storage class.

8.11

When an array with external linkage is declared, its size should be explicitly specified.

8.12

Within an enumerator list, the value of an implicitly-specified enumeration constant shall be unique.

8.14

The restrict type qualifier shall not be used.

Initialization

RuleDescription
9.2

The initializer for an aggregate or union shall be enclosed in braces.

9.3

Arrays shall not be partially initialized.

9.4

An element of an object shall not be initialized more than once.

9.5

Where designated initializers are used to initialize an array object the size of the array shall be specified explicitly.

The Essential Type Model

RuleDescription
10.1

Operands shall not be of an inappropriate essential type.

10.2

Expressions of essentially character type shall not be used inappropriately in addition and subtraction operations.

10.3

The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category.

10.4

Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category.

10.5

The value of an expression should not be cast to an inappropriate essential type.

10.6

The value of a composite expression shall not be assigned to an object with wider essential type.

10.7

If a composite expression is used as one operand of an operator in which the usual arithmetic conversions are performed then the other operand shall not have wider essential type.

10.8

The value of a composite expression shall not be cast to a different essential type category or a wider essential type.

Pointer Type Conversion

RuleDescription
11.1

Conversions shall not be performed between a pointer to a function and any other type.

11.2

Conversions shall not be performed between a pointer to an incomplete type and any other type.

11.3

A cast shall not be performed between a pointer to object type and a pointer to a different object type.

11.4

A conversion should not be performed between a pointer to object and an integer type.

11.5

A conversion should not be performed from pointer to void into pointer to object.

11.6

A cast shall not be performed between pointer to void and an arithmetic type.

11.7

A cast shall not be performed between pointer to object and a non-integer arithmetic type.

11.8

A cast shall not remove any const or volatile qualification from the type pointed to by a pointer.

11.9

The macro NULL shall be the only permitted form of integer null pointer constant.

Expressions

RuleDescription
12.1

The precedence of operators within expressions should be made explicit.

12.3

The comma operator should not be used.

12.4

Evaluation of constant expressions should not lead to unsigned integer wrap-around.

Side Effects

RuleDescription
13.3

A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator.

13.4

The result of an assignment operator should not be used.

13.6

The operand of the sizeof operator shall not contain any expression which has potential side effects.

Control Statement Expressions

RuleDescription
14.4

The controlling expression of an if statement and the controlling expression of an iteration-statement shall have essentially Boolean type.

Control Flow

RuleDescription
15.1

The goto statement should not be used.

15.2

The goto statement shall jump to a label declared later in the same function.

15.3

Any label referenced by a goto statement shall be declared in the same block, or in any block enclosing the goto statement.

15.4

There should be no more than one break or goto statement used to terminate any iteration statement.

15.5

A function should have a single point of exit at the end

15.6

The body of an iteration-statement or a selection-statement shall be a compound statement.

15.7

All if … else if constructs shall be terminated with an else statement.

Switch Statements

RuleDescription
16.1

All switch statements shall be well-formed.

16.2

A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement.

16.3

An unconditional break statement shall terminate every switch-clause.

16.4

Every switch statement shall have a default label.

16.5

A default label shall appear as either the first or the last switch label of a switch statement.

16.6

Every switch statement shall have at least two switch-clauses.

16.7

A switch-expression shall not have essentially Boolean type.

Functions

RuleDescription
17.1

The features of <starg.h> shall not be used.

17.3

A function shall not be declared implicitly.

17.4

All exit paths from a function with non-void return type shall have an explicit return statement with an expression.

17.6

The declaration of an array parameter shall not contain the static keyword between the [ ].

17.7

The value returned by a function having non-void return type shall be used.

Pointers and Arrays

RuleDescription
18.4

The +, -, += and -= operators should not be applied to an expression of pointer type.

18.5

Declarations should contain no more than two levels of pointer nesting.

18.7

Flexible array members shall not be declared.

18.8

Variable-length array types shall not be used.

Overlapping Storage

RuleDescription
19.2

The union keyword should not be used.

Preprocessing Directives

RuleDescription
20.1

#include directives should only be preceded by preprocessor directives or comments.

20.2

The ', ", or \ characters and the /* or // character sequences shall not occur in a header file name.

20.3

The #include directive shall be followed by either a <filename> or \"filename\" sequence.

20.4

A macro shall not be defined with the same name as a keyword.

20.5

#undef should not be used.

20.6

Tokens that look like a preprocessing directive shall not occur within a macro argument.

20.7

Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses.

20.8

The controlling expression of a #if or #elif preprocessing directive shall evaluate to 0 or 1.

20.9

All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be #define'd before evaluation.

20.10

The # and ## preprocessor operators should not be used.

20.11

A macro parameter immediately following a # operator shall not immediately be followed by a ## operator.

20.12

A macro parameter used as an operand to the # or ## operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators.

20.13

A line whose first token is # shall be a valid preprocessing directive.

20.14

All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are related.

Standard Libraries

RuleDescription
21.1

#define and #undef shall not be used on a reserved identifier or reserved macro name.

21.2

A reserved identifier or macro name shall not be declared.

21.3

The memory allocation and deallocation functions of <stdlib.h> shall not be used.

21.4

The standard header file <setjmp.h> shall not be used.

21.5

The standard header file <signal.h> shall not be used.

21.6

The Standard Library input/output functions shall not be used.

21.7

The atof, atoi, atol, and atoll functions of <stdlib.h> shall not be used.

21.8

The library functions abort, exit, getenv and system of <stdlib.h> shall not be used.

21.9

The library functions bsearch and qsort of <stdlib.h> shall not be used.

21.10

The Standard Library time and date functions shall not be used.

21.11

The standard header file <tgmath.h> shall not be used.

21.12

The exception handling features of <fenv.h> should not be used.

MISRA C++ 2008 Rules

Language Independent Issues

RuleDescription
0-1-7The value returned by a function having a non-void return type that is not an overloaded operator shall always be used.
0-1-11There shall be no unused parameters (named or unnamed) in non- virtual functions.
0-1-12There shall be no unused parameters (named or unnamed) in the set of parameters for a virtual function and all the functions that override it.
0-2-1An object shall not be assigned to an overlapping object.

General

RuleDescription
1-0-1All code shall conform to ISO/IEC 14882:2003 "The C++ Standard Incorporating Technical Corrigendum 1".

Lexical Conventions

RuleDescription
2-3-1Trigraphs shall not be used.
2-5-1Digraphs should not be used.
2-7-1The character sequence /* shall not be used within a C-style comment.
2-10-1Different identifiers shall be typographically unambiguous.
2-10-2Identifiers declared in an inner scope shall not hide an identifier declared in an outer scope.
2-10-3A typedef name (including qualification, if any) shall be a unique identifier.
2-10-4A class, union or enum name (including qualification, if any) shall be a unique identifier.
2-10-6If an identifier refers to a type, it shall not also refer to an object or a function in the same scope.
2-13-1Only those escape sequences that are defined in ISO/IEC 14882:2003 shall be used.
2-13-2Octal constants (other than zero) and octal escape sequences (other than "\0") shall not be used.
2-13-3A "U" suffix shall be applied to all octal or hexadecimal integer literals of unsigned type.
2-13-4Literal suffixes shall be upper case.
2-13-5Narrow and wide string literals shall not be concatenated.

Basic Concepts

RuleDescription
3-1-1It shall be possible to include any header file in multiple translation units without violating the One Definition Rule.
3-1-2Functions shall not be declared at block scope.
3-1-3When an array is declared, its size shall either be stated explicitly or defined implicitly by initialization.
3-3-1Objects or functions with external linkage shall be declared in a header file.
3-3-2If a function has internal linkage then all re-declarations shall include the static storage class specifier.
3-4-1An identifier declared to be an object or type shall be defined in a block that minimizes its visibility.
3-9-1The types used for an object, a function return type, or a function parameter shall be token-for-token identical in all declarations and re-declarations.
3-9-2Typedefs that indicate size and signedness should be used in place of the basic numerical types.
3-9-3The underlying bit representations of floating-point values shall not be used.

Standard Conversions

RuleDescription
4-5-1Expressions with type bool shall not be used as operands to built-in operators other than the assignment operator =, the logical operators &&, ||, !, the equality operators == and !=, the unary & operator, and the conditional operator.
4-5-2Expressions with type enum shall not be used as operands to built- in operators other than the subscript operator [ ], the assignment operator =, the equality operators == and !=, the unary & operator, and the relational operators <, <=, >, >=.
4-5-3Expressions with type (plain) char and wchar_t shall not be used as operands to built-in operators other than the assignment operator =, the equality operators == and !=, and the unary & operator.

Expressions

RuleDescription
5-0-1The value of an expression shall be the same under any order of evaluation that the standard permits.
5-0-2Limited dependence should be placed on C++ operator precedence rules in expressions.
5-0-3A cvalue expression shall not be implicitly converted to a different underlying type.
5-0-4An implicit integral conversion shall not change the signedness of the underlying type.
5-0-5There shall be no implicit floating-integral conversions.
5-0-6An implicit integral or floating-point conversion shall not reduce the size of the underlying type.
5-0-7There shall be no explicit floating-integral conversions of a cvalue expression.
5-0-8An explicit integral or floating-point conversion shall not increase the size of the underlying type of a cvalue expression.
5-0-9An explicit integral conversion shall not change the signedness of the underlying type of a cvalue expression.
5-0-10If the bitwise operators ~ and << are applied to an operand with an underlying type of unsigned char or unsigned short, the result shall be immediately cast to the underlying type of the operand.
5-0-11The plain char type shall only be used for the storage and use of character values.
5-0-12signed char and unsigned char type shall only be used for the storage and use of numeric values.
5-0-13The condition of an if-statement and the condition of an iteration-statement shall have type bool.
5-0-14The first operand of a conditional-operator shall have type bool.
5-0-15Array indexing shall be the only form of pointer arithmetic.
5-0-18>, >=, <, <= shall not be applied to objects of pointer type, except where they point to the same array.
5-0-19The declaration of objects shall contain no more than two levels of pointer indirection.
5-0-20Non-constant operands to a binary bitwise operator shall have the same underlying type.
5-0-21Bitwise operators shall only be applied to operands of unsigned underlying type.
5-2-1Each operand of a logical && or || shall be a postfix - expression.
5-2-2A pointer to a virtual base class shall only be cast to a pointer to a derived class by means of dynamic_cast.
5-2-3Casts from a base class to a derived class should not be performed on polymorphic types.
5-2-4C-style casts (other than void casts) and functional notation casts (other than explicit constructor calls) shall not be used.
5-2-5A cast shall not remove any const or volatile qualification from the type of a pointer or reference.
5-2-6A cast shall not convert a pointer to a function to any other pointer type, including a pointer to function type.
5-2-7An object with pointer type shall not be converted to an unrelated pointer type, either directly or indirectly.
5-2-8An object with integer type or pointer to void type shall not be converted to an object with pointer type.
5-2-9A cast should not convert a pointer type to an integral type.
5-2-10The increment ( ++ ) and decrement ( -- ) operators should not be mixed with other operators in an expression.
5-2-11The comma operator, && operator and the || operator shall not be overloaded.
5-2-12An identifier with array type passed as a function argument shall not decay to a pointer.
5-3-1Each operand of the ! operator, the logical && or the logical || operators shall have type bool.
5-3-2The unary minus operator shall not be applied to an expression whose underlying type is unsigned.
5-3-3The unary & operator shall not be overloaded.
5-3-4Evaluation of the operand to the sizeof operator shall not contain side effects.
5-8-1The right hand operand of a shift operator shall lie between zero and one less than the width in bits of the underlying type of the left hand operand.
5-14-1The right hand operand of a logical && or || operator shall not contain side effects.
5-18-1The comma operator shall not be used.
5-19-1Evaluation of constant unsigned integer expressions should not lead to wrap-around.

Statements

RuleDescription
6-2-1Assignment operators shall not be used in sub-expressions.
6-2-2Floating-point expressions shall not be directly or indirectly tested for equality or inequality.
6-2-3Before preprocessing, a null statement shall only occur on a line by itself; it may be followed by a comment, provided that the first character following the null statement is a white - space character.
6-3-1The statement forming the body of a switch, while, do ... while or for statement shall be a compound statement.
6-4-1An if ( condition ) construct shall be followed by a compound statement. The else keyword shall be followed by either a compound statement, or another if statement.
6-4-2All if ... else if constructs shall be terminated with an else clause.
6-4-3A switch statement shall be a well-formed switch statement.
6-4-4A switch-label shall only be used when the most closely-enclosing compound statement is the body of a switch statement.
6-4-5An unconditional throw or break statement shall terminate every non - empty switch-clause.
6-4-6The final clause of a switch statement shall be the default-clause.
6-4-7The condition of a switch statement shall not have bool type.
6-4-8Every switch statement shall have at least one case-clause.
6-5-1A for loop shall contain a single loop-counter which shall not have floating type.
6-5-2If loop-counter is not modified by -- or ++, then, within condition, the loop-counter shall only be used as an operand to <=, <, > or >=.
6-5-3The loop-counter shall not be modified within condition or statement.
6-5-4The loop-counter shall be modified by one of: --, ++, -=n, or +=n ; where n remains constant for the duration of the loop.
6-5-5A loop-control-variable other than the loop-counter shall not be modified within condition or expression.
6-5-6A loop-control-variable other than the loop-counter which is modified in statement shall have type bool.
6-6-1Any label referenced by a goto statement shall be declared in the same block, or in a block enclosing the goto statement.
6-6-2The goto statement shall jump to a label declared later in the same function body.
6-6-3The continue statement shall only be used within a well-formed for loop.
6-6-4For any iteration statement there shall be no more than one break or goto statement used for loop termination.
6-6-5A function shall have a single point of exit at the end of the function.

Declarations

RuleDescription
7-3-1The global namespace shall only contain main, namespace declarations and extern "C" declarations.
7-3-2The identifier main shall not be used for a function other than the global function main.
7-3-3There shall be no unnamed namespaces in header files.
7-3-4using-directives shall not be used.
7-3-5Multiple declarations for an identifier in the same namespace shall not straddle a using-declaration for that identifier.
7-3-6using-directives and using-declarations (excluding class scope or function scope using-declarations) shall not be used in header files.
7-4-2Assembler instructions shall only be introduced using the asm declaration.
7-4-3Assembly language shall be encapsulated and isolated.

Declarators

RuleDescription
8-0-1An init-declarator-list or a member-declarator-list shall consist of a single init-declarator or member-declarator respectively.
8-3-1Parameters in an overriding virtual function shall either use the same default arguments as the function they override, or else shall not specify any default arguments.
8-4-1Functions shall not be defined using the ellipsis notation.
8-4-2The identifiers used for the parameters in a re-declaration of a function shall be identical to those in the declaration.
8-4-3All exit paths from a function with non- void return type shall have an explicit return statement with an expression.
8-4-4A function identifier shall either be used to call the function or it shall be preceded by &.
8-5-2Braces shall be used to indicate and match the structure in the non- zero initialization of arrays and structures.
8-5-3In an enumerator list, the = construct shall not be used to explicitly initialize members other than the first, unless all items are explicitly initialized.

Classes

RuleDescription
9-3-1const member functions shall not return non-const pointers or references to class-data.
9-3-2Member functions shall not return non-const handles to class-data.
9-5-1Unions shall not be used.
9-6-2Bit-fields shall be either bool type or an explicitly unsigned or signed integral type.
9-6-3Bit-fields shall not have enum type.
9-6-4Named bit-fields with signed integer type shall have a length of more than one bit.

Derived Classes

RuleDescription
10-1-1Classes should not be derived from virtual bases.
10-1-2A base class shall only be declared virtual if it is used in a diamond hierarchy.
10-1-3An accessible base class shall not be both virtual and non-virtual in the same hierarchy.
10-2-1All accessible entity names within a multiple inheritance hierarchy should be unique.
10-3-1There shall be no more than one definition of each virtual function on each path through the inheritance hierarchy.
10-3-2Each overriding virtual function shall be declared with the virtual keyword.
10-3-3A virtual function shall only be overridden by a pure virtual function if it is itself declared as pure virtual.

Member Access Control

RuleDescription
11-0-1Member data in non- POD class types shall be private.

Special Member Functions

RuleDescription
12-1-1An object's dynamic type shall not be used from the body of its constructor or destructor.
12-1-2All constructors of a class should explicitly call a constructor for all of its immediate base classes and all virtual base classes.
12-1-3All constructors that are callable with a single argument of fundamental type shall be declared explicit.
12-8-1A copy constructor shall only initialize its base classes and the non- static members of the class of which it is a member.
12-8-2The copy assignment operator shall be declared protected or private in an abstract class.

Templates

RuleDescription
14-5-2A copy constructor shall be declared when there is a template constructor with a single parameter that is a generic parameter.
14-5-3A copy assignment operator shall be declared when there is a template assignment operator with a parameter that is a generic parameter.
14-6-1In a class template with a dependent base, any name that may be found in that dependent base shall be referred to using a qualified-id or this->.
14-6-2The function chosen by overload resolution shall resolve to a function declared previously in the translation unit.
14-7-3All partial and explicit specializations for a template shall be declared in the same file as the declaration of their primary template.
14-8-1Overloaded function templates shall not be explicitly specialized.
14-8-2The viable function set for a function call should either contain no function specializations, or only contain function specializations.

Exception Handling

RuleDescription
15-0-2An exception object should not have pointer type.
15-0-3Control shall not be transferred into a try or catch block using a goto or a switch statement.
15-1-2NULL shall not be thrown explicitly.
15-1-3An empty throw (throw;) shall only be used in the compound- statement of a catch handler.
15-3-2There should be at least one exception handler to catch all otherwise unhandled exceptions
15-3-3Handlers of a function-try-block implementation of a class constructor or destructor shall not reference non-static members from this class or its bases.
15-3-5A class type exception shall always be caught by reference.
15-3-6Where multiple handlers are provided in a single try-catch statement or function-try-block for a derived class and some or all of its bases, the handlers shall be ordered most-derived to base class.
15-3-7Where multiple handlers are provided in a single try-catch statement or function-try-block, any ellipsis (catch-all) handler shall occur last.
15-5-1A class destructor shall not exit with an exception.
15-5-2Where a function's declaration includes an exception-specification, the function shall only be capable of throwing exceptions of the indicated type(s).

Preprocessing Directives

RuleDescription
16-0-1#include directives in a file shall only be preceded by other preprocessor directives or comments.
16-0-2Macros shall only be #define 'd or #undef 'd in the global namespace.
16-0-3#undef shall not be used.
16-0-4Function-like macros shall not be defined.
16-0-5Arguments to a function-like macro shall not contain tokens that look like preprocessing directives.
16-0-6In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ##.
16-0-7 Undefined macro identifiers shall not be used in #if or #elif preprocessor directives, except as operands to the defined operator.
16-0-8If the # token appears as the first token on a line, then it shall be immediately followed by a preprocessing token.
16-1-1The defined preprocessor operator shall only be used in one of the two standard forms.
16-1-2All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if or #ifdef directive to which they are related.
16-2-1The pre-processor shall only be used for file inclusion and include guards.
16-2-2C++ macros shall only be used for: include guards, type qualifiers, or storage class specifiers.
16-2-3Include guards shall be provided.
16-2-4The ', ", /* or // characters shall not occur in a header file name.
16-2-5The \ character should not occur in a header file name.
16-2-6The #include directive shall be followed by either a <filename> or "filename" sequence.
16-3-1There shall be at most one occurrence of the # or ## operators in a single macro definition.
16-3-2The # and ## operators should not be used.
16-6-1All uses of the #pragma directive shall be documented.
17-0-1Reserved identifiers, macros and functions in the standard library shall not be defined, redefined or undefined.
17-0-2The names of standard library macros and objects shall not be reused.
17-0-5The setjmp macro and the longjmp function shall not be used.

Language Support Library

RuleDescription
18-0-1The C library shall not be used.
18-0-2The library functions atof, atoi and atol from library <cstdlib> shall not be used.
18-0-3The library functions abort, exit, getenv and system from library <cstdlib> shall not be used.
18-0-4The time handling functions of library <ctime> shall not be used.
18-0-5The unbounded functions of library <cstring> shall not be used.
18-2-1The macro offsetof shall not be used.
18-4-1Dynamic heap memory allocation shall not be used.
18-7-1The signal handling facilities of <csignal> shall not be used.

Diagnostic Library

RuleDescription
19-3-1The error indicator errno shall not be used.

Input/Output Library

RuleDescription
27-0-1The stream input/output library <cstdio> shall not be used.