Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleGenerated Content

This page is automatically generated from the "Automated Detection" sections in the individual guidelines. Do not modify this page directly.

Version number:
1.12

C++ checkers

Rule

araydecl CC2.DCL36

ARR02DCL36-CPP. Explicitly specify array bounds, even if implicitly defined by an initializerDo not declare an identifier with conflicting linkage classifications

CC2.EXP30

EXP30

araydecl

STR36-CPP. Do not specify the bound of a character array initialized with a string literaldepend on order of evaluation between sequence points

CC2.FLP30

FLP30

bitftype

INT12-CPP. Do not make assumptions about the type of a plain int bit-field when used in an expression

callargs

EXP37-CPP. Call variadic functions with the arguments intended by the API

castexpr

EXP05-CPP. Do not use C-style casts

castexpr

EXP14-CPP. Do not use reinterpret_cast on pointers to class objects with multiple inheritence

castexpr

EXP35-CPP. Do not cast away a const qualification

castexpr

EXP36-CPP. Do not convert pointers into more strictly aligned pointer types

charcast

STR34-CPP. Cast characters to unsigned types before converting to larger integer sizes

charsgnd

STR04-CPP. Use plain char for characters in the basic character set

cmntdout_tokenuse

MSC04-CPP. Use comments consistently and in a readable fashion

cnstpnte

DCL00-CPP. Const-qualify immutable objects

use floating point variables as loop counters

CP1.ARR02

ARR02-CPP. Explicitly specify array bounds, even if implicitly defined by an initializer

CP1.DCL00

DCL00-CPP. Const-qualify immutable objects

CP1.DCL01

DCL01-CPP. Do not reuse variable names in subscopes

CP1.DCL02

DCL02-CPP. Use visually distinct identifiers

CP1.DCL03

DCL03-CPP. Use a static assertion to test the value of a constant expression

CP1.DCL04

DCL04-CPP. Do not declare more than one variable per declaration

CP1.DCL06

DCL06-CPP. Use meaningful symbolic constants to represent literal values in program logic

CP1.DCL07

DCL07-CPP. Minimize the scope of variables and methods

CP1.DCL13 cnstpnte

DCL13-CPP. Declare function parameters that are pointers to values not changed by the function as const

cplxcall CP1.DCL15

FLP31DCL15-CPP. Do not call functions expecting real values with complex values

declgrup_srceline

DCL04-CPP. Do not declare more than one variable per declaration

declhidn

DCL01-CPP. Do not reuse variable names in subscopes

declused

MSC22-CPP. Do not define static private members

dtrigraf

PRE07-CPP. Avoid using repeated question marks

enuminit

INT09-CPP. Ensure enumeration constants map to unique values

evalordr

EXP30-CPP. Do not depend on order of evaluation between sequence points

exprctxt

EXP19-CPP. Do not perform assignments in conditional expressions

exprctxt

MSC05-CPP. Do not manipulate time_t typed values directly

exprprns

EXP00-CPP. Use parentheses for precedence of operation

Declare file-scope objects or functions that do not need external linkage in an unnamed namespace

CP1.DCL16

DCL16-CPP. Use "L," not "l," to indicate a long value

CP1.ERR01

ERR01-CPP. Use ferror() rather than errno to check for FILE stream errors

CP1.ERR36

ERR36-CPP. Multiple catch handlers to a try block should order their exceptions from most derived to most basic

CP1.EXP00

EXP00-CPP. Use parentheses for precedence of operation

CP1.EXP05

EXP05-CPP. Do not use C-style casts

CP1.EXP06

EXP06-CPP. Operands to the sizeof operator should not contain side effects

CP1.EXP09

EXP09-CPP. Use sizeof to determine the size of a type or variable

CP1.EXP12

EXP12-CPP. Do not ignore values returned by functions or methods

CP1.EXP14

EXP14-CPP. Do not use reinterpret_cast on pointers to class objects with multiple inheritence

CP1.EXP15

EXP15-CPP. Beware of integer promotion when performing bitwise operations on chars or shorts

CP1.EXP17 exprprns

EXP17-CPP. Treat relational and equality operators as if they were nonassociative

filscope

DCL07-CPP. Minimize the scope of variables and methods

filscope

DCL15-CPP. Declare file-scope objects or functions that do not need external linkage in an unnamed namespace

CP1.EXP19

EXP19-CPP. Do not perform assignments in conditional expressions

CP1.EXP31

EXP31-CPP. Avoid side effects in assertions

CP1.EXP35

EXP35-CPP. Do not cast away a const qualification

CP1.EXP36

EXP36-CPP. Do not convert pointers into more strictly aligned pointer types

CP1.EXP37

EXP37-CPP. Call variadic functions with the arguments intended by the API

CP1.FIO07

FIO07-CPP. Prefer fseek() to rewind()

CP1.FIO12

FIO12-CPP. Prefer setvbuf() to setbuf()

CP1.FLP31

FLP31-CPP. Do not call functions expecting real values with complex values

CP1.FLP35 floateql

FLP35-CPP. Take granularity into account when comparing floating point values

CP1.INT02

INT02-CPP. Understand integer conversion rules

CP1.INT04

INT34

forcntrl

FLP30-CPP. Do not use floating point variables as loop counters

funcalls

EXP09-CPP. Use sizeof to determine the size of a type or variable

shift a negative number of bits or more bits than exist in the operand

CP1.INT07

INT07-CPP. Use only explicitly signed or unsigned char type for numeric values

CP1.INT09

INT09-CPP. Ensure enumeration constants map to unique values

CP1.INT12

INT12-CPP. Do not make assumptions about the type of a plain int bit-field when used in an expression

CP1.INT13

INT13-CPP. Use bitwise operators only on unsigned operands

CP1.MEM02 funcalls

MEM02-CPP. Immediately cast the result of a memory allocation function call into a pointer to the allocated type

hedrname CP1.MSC04

PRE04MSC04-CPP. Do not reuse a standard header file name

hedrname

PRE08-CPP. Guarantee that header file names are unique

idb_charplan

INT07-CPP. Use only explicitly signed or unsigned char type for numeric values

idb_charplan

STR37-CPP. Arguments to character handling functions must be representable as an unsigned char

idntsiml

DCL02-CPP. Use visually distinct identifiers

ignrtrn

EXP12-CPP. Do not ignore values returned by functions or methods

inclgard

PRE06-CPP. Enclose header files in an inclusion guard

intllnkg

DCL36-CPP. Do not declare an identifier with conflicting linkage classifications

ltrlsynt

DCL16-CPP. Use "L," not "l," to indicate a long value

Use comments consistently and in a readable fashion

CP1.MSC05

MSC05-CPP. Do not manipulate time_t typed values directly

CP1.MSC12

MSC12-CPP. Detect and remove code that has no effect

CP1.MSC18

MSC18-CPP. Finish every set of statements associated with a case label with a break statement

CP1.MSC20

MSC20-CPP. Do not use a switch statement to transfer control into a complex block

CP1.MSC22

MSC22-CPP. Do not define static private members

CP1.MSC30

MSC30-CPP. Do not use the rand() function for generating pseudorandom numbers

CP1.PRE00

PRE00-CPP. Avoid defining macros

CP1.PRE01 macrbody

PRE01-CPP. Use parentheses within macros around parameter names

macrbody CP1.PRE02

PRE02-CPP. Macro replacement lists should be parenthesized

macrbody CP1.PRE03

PRE12PRE03-CPP. Do not define unsafe macrosPrefer typedefs to defines for encoding types

CP1.PRE04

PRE04

macrcall

DCL03-CPP. Use a static assertion to test the value of a constant expression

macrcall

EXP31-CPP. Avoid side effects in assertions

macrcall

PRE00-CPP. Avoid defining macros

macrcall

PRE31-CPP. Avoid side-effects in arguments to unsafe macros

macrexpd

PRE03-CPP. Prefer typedefs to defines for encoding types

noeffect

MSC12-CPP. Detect and remove code that has no effect

nomagicc

DCL06-CPP. Use meaningful symbolic constants to represent literal values in program logic

optrargs

INT13-CPP. Use bitwise operators only on unsigned operands

shiftrhs

INT34-CPP. Do not shift a negative number of bits or more bits than exist in the operand

stlibuse

ERR01-CPP. Use ferror() rather than errno to check for FILE stream errors

stlibuse

FIO07-CPP. Prefer fseek() to rewind()

stlibuse

FIO12-CPP. Prefer setvbuf() to setbuf()

stlibuse

MSC30-CPP. Do not use the rand() function for generating pseudorandom numbers

swchsynt

MSC18-CPP. Finish every set of statements associated with a case label with a break statement

swchsynt

MSC20-CPP. Do not use a switch statement to transfer control into a complex block

trycatch

ERR36-CPP. Multiple catch handlers to a try block should order their exceptions from most derived to most basic

unexfct

EXP06-CPP. Operands to the sizeof operator should not contain side effects

utypbtws

EXP15-CPP. Beware of integer promotion when performing bitwise operations on chars or shorts

Do not reuse a standard header file name

CP1.PRE06

PRE06-CPP. Enclose header files in an inclusion guard

CP1.PRE07

PRE07-CPP. Avoid using repeated question marks

CP1.PRE08

PRE08-CPP. Guarantee that header file names are unique

CP1.PRE12

PRE12-CPP. Do not define unsafe macros

CP1.PRE31

PRE31-CPP. Avoid side-effects in arguments to unsafe macros

CP1.STR04

STR04-CPP. Use plain char for characters in the basic character set

CP1.STR34

STR34-CPP. Cast characters to unsigned types before converting to larger integer sizes

CP1.STR36

STR36-CPP. Do not specify the bound of a character array initialized with a string literal

CP1.STR37

STR37-CPP. Arguments to character handling functions must be representable as an unsigned char

utypbtws

INT02-CPP. Understand integer conversion rules