Next: High Integrity CPP Rule 5.2  Up: 5 Control Flow  Previous: 5 Control Flow  Contents

High Integrity CPP Rule 5.1   Follow each flow control primitive ('if', 'else', 'while', 'for', 'do' and 'switch') by a block enclosed by braces, even if the block is empty or contains only one line.
(QA C++  4013, 4014, 4016, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4068)

Justification

The consistent application of braces to delimit a block makes the code clearer, more consistent, and less error prone.

See also

Rule 5.11

Reference

Industrial Strength C++ 4.3;


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