| JSF++ |
Category | C/C++ Warning Classes |
| JSF++:1 Any one function (or method) will contain no more than 200 logical source lines of code (L-SLOCs). |
Will | |
| JSF++:3 All functions shall have a cyclomatic complexity number of 20 or less. |
Shall | |
| JSF++:11 Trigraphs will not be used. |
Will | |
| JSF++:13 Multi-byte characters and wide string literals will not be used. |
Will | |
| JSF++:14 Literal suffixes shall use uppercase rather than lowercase letters. |
Shall | |
| JSF++:17 The error indicator errno shall not be used. |
Shall | |
| JSF++:18 The macro offsetof, in library <stddef.h>, shall not be used. |
Shall | |
| JSF++:19 <locale.h> and the setlocale function shall not be used. |
Shall | |
| JSF++:20 The setjmp macro and the longjmp function shall not be used. |
Shall | |
| JSF++:21 The signal handling facilities of <signal.h> shall not be used. |
Shall | |
| JSF++:22 The input/output library <stdio.h> shall not be used. |
Shall | |
| JSF++:23 The library functions atof, atoi and atol from library <stdlib.h> shall not be used. |
Shall | |
| JSF++:24 The library functions abort, exit, getenv and system from library <stdlib.h> shall not be used. |
Shall | |
| JSF++:25 The time handling functions of library <time.h> shall not be used. |
Shall | |
JSF++:26 Only the following pre-processor directives shall be used: - #ifndef
- #define
- #endif
- #include
Abbreviated form used elsewhere in this manual: "Only the following pre-processor directives shall be used: #ifndef, #define, #endif, #include." |
Shall | |
| JSF++:28 The #ifndef and #endif pre-processor directives will only be used as defined in AV Rule 27 to prevent multiple inclusions of the same header file. |
Will | |
| JSF++:29 The #define pre-processor directive shall not be used to create inline macros. Inline functions shall be used instead. |
Shall | |
| JSF++:30 The #define pre-processor directive shall not be used to define constant values. Instead, the const qualifier shall be applied to variable declarations to specify constant values. |
Shall | |
| JSF++:31 The #define pre-processor directive will only be used as part of the technique to prevent multiple inclusions of the same header file. |
Will | |
| JSF++:32 The #include pre-processor directive will only be used to include header (*.h) files. |
Will | |
| JSF++:33 The #include directive shall use the <filename.h> notation to include header files. |
Shall | |
| JSF++:39 Header files (*.h) will not contain non-const variable definitions or function definitions. |
Will | |
| JSF++:40 Every implementation file shall include the header files that uniquely define the inline functions, types, and templates used. |
Shall | |
| JSF++:42 Each expression-statement will be on a separate line. |
Will | |
| JSF++:46 User-specified identifiers (internal and external) will not rely on significance of more than 64 characters. |
Will | |
| JSF++:47 Identifiers will not begin with the underscore character '_'. |
Will | |
JSF++:48 Identifiers will not differ by:- Only a mixture of case
- The presence/absence of the underscore character
- The interchange of the letter 'O', with the number '0' or the letter 'D'
- The interchange of the letter 'I', with the number '1' or the letter 'l'
- The interchange of the letter 'S' with the number '5'
- The interchange of the letter 'Z' with the number 2
- The interchange of the letter 'n' with the letter 'h'.
Abbreviated form used elsewhere in this manual: "Identifiers will not be typographically ambiguous." |
Will | |
| JSF++:50 The first word of the name of a class, structure, namespace, enumeration, or type created with typedef will begin with an uppercase letter. All others letters will be lowercase. |
Will | |
| JSF++:51 All letters contained in function and variable names will be composed entirely of lowercase letters. |
Will | |
| JSF++:52 Identifiers for constant and enumerator values shall be lowercase. |
Shall | |
| JSF++:53.1 The following character sequences shall not appear in header file names: ', \, /*, //, or ". |
Shall | |
| JSF++:59 The statements forming the body of an if, else if, else, while, do...while or for statement shall always be enclosed in braces, even if the braces form an empty block. |
Shall | |
| JSF++:68 Unneeded implicitly generated member functions shall be explicitly disallowed. |
Shall | |
| JSF++:70.1 An object shall not be improperly used before its lifetime begins or after its lifetime ends. |
Shall | |
| JSF++:71 Calls to an externally visible operation of an object, other than its constructors, shall not be allowed until the object has been fully initialized. |
Shall | |
| JSF++:71.1 A class's virtual functions shall not be invoked from its destructor or any of its constructors. |
Shall | |
| JSF++:75 Members of the initialization list shall be listed in the order in which they are declared in the class. |
Shall | |
| JSF++:76 A copy constructor and an assignment operator shall be declared for classes that contain pointers to data items or nontrivial destructors. |
Shall | |
| JSF++:77.1 The definition of a member function shall not contain default arguments that produce a signature identical to that of the implicitly-declared copy constructor for the corresponding class/structure. |
Shall | |
| JSF++:78 All base classes with a virtual function shall define a virtual destructor. |
Shall | |
| JSF++:79 All resources acquired by a class shall be released by the class's destructor. |
Shall | |
| JSF++:80 The default copy and assignment operators will be used for classes when those operators offer reasonable semantics. |
Will | |
| JSF++:81 The assignment operator shall handle self-assignment correctly. |
Shall | |
| JSF++:82 An assignment operator shall return a reference to *this. |
Shall | |
| JSF++:88 Multiple inheritance shall only be allowed in the following restricted form: n interfaces plus m private implementations, plus at most one protected implementation. |
Shall | |
| JSF++:88.1 A stateful virtual base shall be explicitly declared in each derived class that accesses it. |
Shall | |
| JSF++:89 A base class shall not be both virtual and non-virtual in the same hierarchy. |
Shall | |
| JSF++:94 An inherited nonvirtual function shall not be redefined in a derived class. |
Shall | |
| JSF++:95 An inherited default parameter shall never be redefined. |
Shall | |
| JSF++:96 Arrays shall not be treated polymorphically. |
Shall | |
| JSF++:97 Arrays shall not be used in interfaces. Instead, the Array class should be used. |
Shall | |
| JSF++:97.1 Neither operand of an equality operator (== or !=) shall be a pointer to a virtual member function. |
Shall | |
| JSF++:104 A template specialization shall be declared before its use. |
Shall | |
| JSF++:107 Functions shall always be declared at file scope. |
Shall | |
| JSF++:108 Functions with variable numbers of arguments shall not be used. |
Shall | |
| JSF++:110 Functions with more than 7 arguments will not be used. |
Will | |
| JSF++:111 A function shall not return a pointer or reference to a non-static local object. |
Shall | |
| JSF++:112 Function return values should not obscure resource ownership. |
Should | |
| JSF++:113 Functions will have a single exit point. |
Will | |
| JSF++:114 All exit points of value-returning functions shall be through return statements. |
Shall |
| closely mapped |
|
| also related |
|
|
| JSF++:115 If a function returns error information, then that error information will be tested. |
Will | |
| JSF++:117.1 An object should be passed as const T& if the function should not change the value of the object. |
Should | |
| JSF++:119 Functions shall not call themselves, either directly or indirectly (i.e. recursion shall not be allowed). |
Shall | |
| JSF++:126 Only valid C++ style comments (//) shall be used. |
Shall | |
| JSF++:127 Code that is not used (commented out) shall be deleted. |
Shall | |
| JSF++:135 Identifiers in an inner scope shall not use the same name as an identifier in an outer scope, and therefore hide that identifier. |
Shall | |
| JSF++:136 Declarations should be at the smallest feasible scope. |
Should | |
| JSF++:137 All declarations at file scope should be static where possible. |
Should | |
| JSF++:139 External objects will not be declared in more than one file. |
Will | |
| JSF++:140 The register storage class specifier shall not be used. |
Shall | |
| JSF++:142 All variables shall be initialized before use. |
Shall | |
| JSF++:144 Braces shall be used to indicate and match the structure in the non-zero initialization of arrays and structures. |
Shall | |
| JSF++:145 In an enumerator list, the '=' construct shall not be used to explicitly initialize members other than the first, unless all items are explicitly initialized. |
Shall | |
| JSF++:147 The underlying bit representations of floating point numbers shall not be used in any way by the programmer. |
Shall | |
| JSF++:148 Enumeration types shall be used instead of integer types (and constants) to select from a limited series of choices. |
Shall |
| closely mapped |
|
| also related |
|
|
| JSF++:149 Octal constants (other than zero) shall not be used. |
Shall | |
| JSF++:151.1 A string literal shall not be modified. |
Shall | |
| JSF++:152 Multiple variable declarations shall not be allowed on the same line. |
Shall | |
| JSF++:153 Unions shall not be used. |
Shall | |
| JSF++:154 Bit-fields shall have explicitly unsigned integral or enumeration types only. |
Shall | |
| JSF++:156 All the members of a structure (or class) shall be named and shall only be accessed via their names. |
Shall | |
| JSF++:157 The right hand operand of a && or || operator shall not contain side effects. |
Shall |
| closely mapped |
|
| also related |
|
|
| JSF++:158 The operands of a logical && or || shall be parenthesized if the operands contain binary operators. |
Shall | |
| JSF++:159 Operators ||, &&, and unary & shall not be overloaded. |
Shall | |
| JSF++:160 An assignment expression shall be used only as the expression in an expression statement. |
Shall | |
| JSF++:162 Signed and unsigned values shall not be mixed in arithmetic or comparison operations. |
Shall | |
| JSF++:164 The right hand operand of a shift operator shall lie between zero and one less than the width in bits of the left-hand operand (inclusive). |
Shall | |
| JSF++:164.1 The left-hand operand of a right-shift operator shall not have a negative value. |
Shall | |
| JSF++:165 The unary minus operator shall not be applied to an unsigned expression. |
Shall | |
| JSF++:166 The sizeof operator will not be used on expressions that contain side effects. |
Will | |
| JSF++:168 The comma operator shall not be used. |
Shall | |
| JSF++:169 Pointers to pointers should be avoided when possible. |
Should | |
| JSF++:170 More than 2 levels of pointer indirection shall not be used. |
Shall | |
JSF++:171 Relational operators shall not be applied to pointer types except where both operands are of the same type and point to:- the same object,
- the same function,
- members of the same object, or
- elements of the same array (including one past the end of the same array).
Note that if either operand is null, then both shall be null. Also, "members of the same object" should not be construed to include base class subobjects. Abbreviated form used elsewhere in this manual: "Relational operators shall not be applied to pointer types except where both operands are of the same type and point to the same entity." |
Shall | |
| JSF++:173 The address of an object with automatic storage shall not be assigned to an object which persists after the object has ceased to exist. |
Shall | |
| JSF++:174 The null pointer shall not be de-referenced. |
Shall | |
| JSF++:175 A pointer shall not be compared to NULL or be assigned NULL; use plain 0 instead. |
Shall | |
JSF++:178 Down casting (casting from base to derived class) shall only be allowed through one of the following mechanism:- Virtual functions that act like dynamic casts (most likely useful in relatively simple cases)
- Use of the visitor (or similar) pattern (most likely useful in complicated cases)
Abbreviated form used elsewhere in this manual: "Down casting (casting from base to derived class) shall only be allowed through certain mechanisms." |
Shall | |
| JSF++:179 A pointer to a virtual base class shall not be converted to a pointer to a derived class. |
Shall | |
| JSF++:180 Implicit conversions that may result in a loss of information shall not be used. |
Shall | |
| JSF++:182 Type casting from any type to or from pointers shall not be used. |
Shall | |
| JSF++:183 Every possible measure should be taken to avoid type casting. |
Should | |
| JSF++:184 Floating point numbers shall not be converted to integers unless such a conversion is a specified algorithmic requirement or is necessary for a hardware interface. |
Shall | |
| JSF++:185 C++ style casts (const_cast, reinterpret_cast, and static_cast) shall be used instead of the traditional C-style casts. |
Shall | |
| JSF++:186 There shall be no unreachable code. |
Shall | |
| JSF++:187 All non-null statements shall potentially have a side-effect. |
Shall | |
| JSF++:189 The goto statement shall not be used. |
Shall | |
| JSF++:190 The continue statement shall not be used. |
Shall | |
| JSF++:191 The break statement shall not be used (except to terminate the cases of a switch statement). |
Shall | |
| JSF++:192 All if, else if constructs will contain either a final else clause or a comment indicating why a final else clause is not necessary. |
Will | |
| JSF++:193 Every non-empty case clause in a switch statement shall be terminated with a break statement. |
Shall | |
| JSF++:194 All switch statements that do not intend to test for every enumeration value shall contain a final default clause. |
Shall | |
| JSF++:195 A switch expression will not represent a Boolean value. |
Will | |
| JSF++:196 Every switch statement will have at least two cases and a potential default. |
Will | |
| JSF++:197 Floating point variables shall not be used as loop counters. |
Shall | |
JSF++:198 The initialization expression in a for loop will perform no actions other than to initialize the value of a single for loop parameter. Note that the initialization expression may invoke an accessor that returns an initial element in a sequence:for (Iter_type p = c.begin() ; p != c.end() ; ++p) // Good
{
...
}
Abbreviated form used elsewhere in this manual: "The initialization expression in a for loop will perform no actions other than to initialize the value of a single for loop parameter." |
Will | |
| JSF++:199 The increment expression in a for loop will perform no action other than to change a single loop parameter to the next value for the loop. |
Will | |
| JSF++:200 Null initialize or increment expressions in for loops will not be used; a while loop will be used instead. |
Will | |
| JSF++:201 Numeric variables being used within a for loop for iteration counting shall not be modified in the body of the loop. |
Shall | |
| JSF++:202 Floating point variables shall not be tested for exact equality or inequality. |
Shall | |
| JSF++:203 Evaluation of expressions shall not lead to overflow/underflow (unless required algorithmically and then should be heavily documented). |
Shall | |
JSF++:204 A single operation with side-effects shall only be used in the following contexts:- by itself
- the right-hand side of an assignment
- a condition
- the only argument expression with a side-effect in a function call
- condition of a loop
- switch condition
- single part of a chained operation.
Abbreviated form used elsewhere in this manual: "A single operation with side-effects shall only be used in certain contexts." |
Shall | |
| JSF++:204.1 The value of an expression shall be the same under any order of evaluation that the standard permits. |
Shall | |
| JSF++:205 The volatile keyword shall not be used unless directly interfacing with hardware. |
Shall | |
| JSF++:206 Allocation/deallocation from/to the free store (heap) shall not occur after initialization. |
Shall | |
| JSF++:208 C++ exceptions shall not be used (i.e. throw, catch and try shall not be used.) |
Shall | |
| JSF++:209 The basic types of int, short, long, float and double shall not be used, but specific-length equivalents should be typedef'd accordingly for each compiler, and these type names used in the code. |
Shall | |
| JSF++:210 Algorithms shall not make assumptions concerning how data is represented in memory (e.g. big endian vs. little endian, base class subobject ordering in derived classes, nonstatic data member ordering across access specifiers, etc.) |
Shall |
| closely mapped |
|
| also related |
|
|
| JSF++:210.1 Algorithms shall not make assumptions concerning the order of allocation of nonstatic data members separated by an access specifier. |
Shall | |
| JSF++:211 Algorithms shall not assume that shorts, ints, longs, floats, doubles or long doubles begin at particular addresses. |
Shall | |
| JSF++:212 Underflow or overflow functioning shall not be depended on in any special way. |
Shall | |
| JSF++:213 No dependence shall be placed on C++'s operator precedence rules, below arithmetic operators, in expressions. |
Shall | |
| JSF++:214 Assuming that non-local static objects, in separate translation units, are initialized in a special order shall not be done. |
Shall | |
| JSF++:215 Pointer arithmetic will not be used. |
Will | |
| JSF++:218 Compiler warning levels will be set in compliance with project policies. |
Will | |