Next: High Integrity CPP Guideline 17.10  Up: 17 Standard Template Library (STL)  Previous: High Integrity CPP Rule 17.8  Contents

High Integrity CPP Rule 17.9   Use vector and string in place of dynamically allocated arrays.

Justification

vector and string automatically manage their storage requirements so the programmer does not need to manage dynamically allocated memory. This removes the potential for inefficiency and memory related bugs that can occur with dynamically allocated arrays.

vector and string contain commonly needed operations and are interoperable with STL algorithims so programmers can avail themselves of a large body of efficient and reliable code.

See also

Rule 8.4.9

Reference

Effective STL Item 13;


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