Next: High Integrity CPP Guideline 8.4.10  Up: 8.4 Object Declarations and Definitions  Previous: High Integrity CPP Rule 8.4.8  Contents

High Integrity CPP Rule 8.4.9   Do not use unbounded (C-style) aggregate types.
(QA C++  0227)

Justification

Array bounds checking is not performed on C-style arrays and any attempt to access memory outside the bounds of an array gives rise to undefined behaviour. Also C-style arrays do not maintain a record of the size of the array.

Array semantics should be provided by C++ classes that enforce appropriate bounds. Prefer to use STL vector template where possible.

Exclusive with

Rule 8.4.8, Rule 10.2

See also

Rule 17.9

Reference

Industrial Strength C++ 13.6;


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