TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
C++ Coding Standard

Rule:  OLC#017Checked automatically with code checker

Synopsis:Initialize all data members of built-in types
Severity Level:1
Category:Object Life Cycle


Data members of user-defined types that have a default constructor need not be explicitly initialized. Built-in types have default constructors, but these do nothing. So, take care to properly initialize data-members of built-in types.

Pointers to built-in types and pointers to user defined types must also be initialized, because they behave like built-in types.

Note that data member initialization occurs in the constructor's initialization list, rather than assignments in the constructor's body. Only when it is not possible to properly initialize a data member, one should assign a value in the constructor's body.

Literature References:
ISC++ Rec. 5.5