Next: 11 Functions  Up: 10 Expressions  Previous: High Integrity CPP Rule 10.20  Contents

High Integrity CPP Rule 10.21   Apply unary minus to operands of signed type only.
(QA C++  3002)

Justification

Unary minus on an unsigned expression, after applying integral promotion, gives an unsigned result which is never negative.


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