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.2

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

C++ checkers

Rule

Checker

Guideline

CC2

.DCL36DCL36-CPP

.

Do not declare an identifier with conflicting linkage classificationsCC2.

EXP30

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

CC2.

FLP30
FLP30-CPP. Do not use floating point variables as loop counters
CP1.ARR02ARR02-CPP. Explicitly specify array bounds, even if implicitly defined by an initializer
CP1.DCL00DCL00-CPP. Const-qualify immutable objects
CP1.DCL01DCL01-CPP. Do not reuse variable names in subscopes
CP1.DCL02DCL02-CPP. Use visually distinct identifiers
CP1.DCL03DCL03-CPP. Use a static assertion to test the value of a constant expression
CP1.DCL04DCL04-CPP. Do not declare more than one variable per declaration
CP1.DCL06DCL06-CPP. Use meaningful symbolic constants to represent literal values in program logic
CP1.DCL07DCL07-CPP. Minimize the scope of variables and methods
CP1.DCL13DCL13-CPP. Declare function parameters that are pointers to values not changed by the function as const
CP1.DCL15DCL15-CPP. Declare file-scope objects or functions that do not need external linkage in an unnamed namespace
CP1.DCL16DCL16-CPP. Use "L," not "l," to indicate a long value

MSC30

:rand() for generating pseudorandom numbers

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

CP1.ERR36

ERR36-CPP.

Multiple catch handlers to a try block

Catch handlers should order their

exceptions

parameter types from most derived to

most basic
CP1.EXP00EXP00-CPP. Use parentheses for precedence of operation
CP1.EXP05EXP05-CPP. Do not use C-style casts
CP1.EXP06EXP06-CPP. Operands to the sizeof operator should not contain side effects
CP1.EXP09EXP09-CPP. Use sizeof to determine the size of a type or variable
CP1.EXP12EXP12-CPP. Do not ignore values returned by functions or methods
CP1.EXP14EXP14-CPP. Do not use reinterpret_cast on pointers to class objects with multiple inheritence
CP1.EXP15EXP15-CPP. Beware of integer promotion when performing bitwise operations on chars or shorts
CP1.EXP17EXP17-CPP. Treat relational and equality operators as if they were nonassociative
CP1.EXP19EXP19-CPP. Do not perform assignments in conditional expressions
CP1.EXP31EXP31-CPP. Avoid side effects in assertions
CP1.EXP35EXP35-CPP. Do not cast away a const qualification
CP1.EXP36EXP36-CPP. Do not convert pointers into more strictly aligned pointer types
CP1.EXP37EXP37-CPP. Call variadic functions with the arguments intended by the API
CP1.FIO07FIO07-CPP. Prefer fseek() to rewind()
CP1.FIO12FIO12-CPP. Prefer setvbuf() to setbuf()
CP1.FLP31FLP31-CPP. Do not call functions expecting real values with complex values
CP1.FLP35FLP35-CPP. Take granularity into account when comparing floating point values
CP1.INT02INT02-CPP. Understand integer conversion rules
CP1.INT04INT34-CPP. Do not shift a negative number of bits or more bits than exist in the operand
CP1.INT07INT07-CPP. Use only explicitly signed or unsigned char type for numeric values
CP1.INT09INT09-CPP. Ensure enumeration constants map to unique values
CP1.INT12INT12-CPP. Do not make assumptions about the type of a plain int bit-field when used in an expression
CP1.INT13INT13-CPP. Use bitwise operators only on unsigned operands
CP1.MEM02MEM02-CPP. Immediately cast the result of a memory allocation function call into a pointer to the allocated type
CP1.MSC04MSC04-CPP. Use comments consistently and in a readable fashion
CP1.MSC05MSC05-CPP. Do not manipulate time_t typed values directly
CP1.MSC12MSC12-CPP. Detect and remove code that has no effect
CP1.MSC18MSC18-CPP. Finish every set of statements associated with a case label with a break statement
CP1.MSC20MSC20-CPP. Do not use a switch statement to transfer control into a complex block
CP1.MSC22MSC22-CPP. Do not define static private members
CP1.MSC30MSC30-CPP. Do not use the rand() function for generating pseudorandom numbers
CP1.PRE00PRE00-CPP. Avoid defining macros
CP1.PRE01PRE01-CPP. Use parentheses within macros around parameter names
CP1.PRE02PRE02-CPP. Macro replacement lists should be parenthesized
CP1.PRE03PRE03-CPP. Prefer typedefs to defines for encoding types
CP1.PRE04PRE04-CPP. Do not reuse a standard header file name
CP1.PRE06PRE06-CPP. Enclose header files in an inclusion guard
CP1.PRE07PRE07-CPP. Avoid using repeated question marks
CP1.PRE08PRE08-CPP. Guarantee that header file names are unique
CP1.PRE12PRE12-CPP. Do not define unsafe macros
CP1.PRE31PRE31-CPP. Avoid side-effects in arguments to unsafe macros
CP1.STR04STR04-CPP. Use plain char for characters in the basic character set
CP1.STR34STR34-CPP. Cast characters to unsigned types before converting to larger integer sizes
CP1.STR36STR36-CPP. Do not specify the bound of a character array initialized with a string literal
CP1.STR37

least derived

>