Next: 13 Portability  Up: index  Previous: 11 Functions  Contents

12 Memory Management

12.1

High Integrity CPP Rule

Do not use default arguments with overloaded functions.

12.2

High Integrity CPP Rule

Allocate memory using 'new' and release using 'delete'. Do not use the C memory management functions malloc(), realloc(), and free().

12.3

High Integrity CPP Rule

Ensure the form used when invoking 'delete' is the same form that was used when memory was allocated using 'new'.

12.4

High Integrity CPP Rule

Do not specify the number of elements when deleting an array of objects.

12.5

High Integrity CPP Rule

Do not return a dereferenced pointer initialised by dynamic allocation within a function.

12.6

High Integrity CPP Rule

Write operator delete if you write operator new.

12.7

High Integrity CPP Rule

Document that operator new and operator delete are static by declaring them static.

12.8

High Integrity CPP Rule

On use of delete always set the pointer to zero after the delete.


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