Next: 9 Exceptions  Up: 8 Declarations and Definitions  Previous: 8.3 Language Restrictions  Contents

8.4 Object Declarations and Definitions

8.4.1

High Integrity CPP Rule

Do not write the characters 'l' (ell) and '1' (one) or 'O' (oh) and '0' (zero) in the same identifier.

8.4.2

High Integrity CPP Rule

Declare each variable on a separate line in a separate declaration statement. If the declaration is not self-explanatory, append a comment describing the variable.

8.4.3

High Integrity CPP Rule

Initialise all objects at definition. Never use an object before it has been given a value.

8.4.4

High Integrity CPP Rule

Postpone variable definitions as long as possible.

8.4.5

High Integrity CPP Rule

Do not use the plain 'char' type when declaring objects that are subject to numeric operations. In this case always use an explicit 'signed char' or 'unsigned char' declaration.

8.4.6

High Integrity CPP Guideline

Use class types or typedefs to indicate scalar quantities.

8.4.7

High Integrity CPP Rule

Declare one type name only in each typedef declaration.

8.4.8

High Integrity CPP Rule

Do not typedef array types.

8.4.9

High Integrity CPP Rule

Do not use unbounded (C-style) aggregate types.

8.4.10

High Integrity CPP Guideline

Avoid pointers to members.

8.4.11

High Integrity CPP Rule

Use 'const' whenever possible.

8.4.12

High Integrity CPP Guideline

Directly append the '*' and '&' to type names in declarations and definitions.

8.4.13

High Integrity CPP Guideline

Prefer to use signed numeric values, not unsigned.


HICPP VERSION 2.4  http://www.codingstandard.com   Copyright: © 2007 THE PROGRAMMING RESEARCH GROUP