Next: 12 Memory Management  Up: index  Previous: 10 Expressions  Contents

11 Functions

11.1

High Integrity CPP Rule

All functions that have the same name should have similar behaviour, varying only in the number and/or types of parameters.

11.2

High Integrity CPP Rule

Enclose all non-member functions that are not part of the external interface in the unnamed namespace in the source file.

11.3

High Integrity CPP Rule

Specify the name of each function parameter in both the function declaration and the function definition. Use the same names in the function declaration and definition.

11.4

High Integrity CPP Rule

Use pass-by-reference in preference to pass by value or pass by pointer.

11.5

High Integrity CPP Rule

Declare read-only parameters of class type as const references. Pass by value read-only parameters that are of a fundamental type.

11.6

High Integrity CPP Rule

Do not use ellipsis '...' in function parameters.

11.7

High Integrity CPP Rule

A function should not return a reference or a pointer to an automatic variable defined within the function. Instead, it should return a copy of the object.

11.8

High Integrity CPP Rule

Only declare trivial functions 'inline'.

11.9

High Integrity CPP Rule

Do not overload on both numeric and pointer types.


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