Next: 8 Declarations and Definitions  Up: 7 Conversions  Previous: High Integrity CPP Rule 7.7  Contents

High Integrity CPP Rule 7.8   Do not write code that relies on implicit conversions of arguments in function calls.
(QA C++  2180, 3050)

Justification

For user defined types, implicit type conversions imply construction and destruction of temporary objects. This can create unexpected side-effects and is often inefficient. Remove use of implicit casts by overloading the function(s) in question with respect to any arguments which are implicitly cast.

See also

Rule 3.2.3, Rule 7.6, Rule 7.7

Reference

Industrial Strength C++ 6.1, 7.18;


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