Difference between revisions of "Cpp Coding Standards/DESIGN/GlobInit"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
Line 1: Line 1:
 
Avoid cross module dependencies when initializing global data. This is because the other objects might reside in a different shared library object, and order of initialization is undefined then. As a rule of thumb, avoid namespace-level  variables if at all possible (consider using the singleton pattern instead, creating the instance on demand).
 
Avoid cross module dependencies when initializing global data. This is because the other objects might reside in a different shared library object, and order of initialization is undefined then. As a rule of thumb, avoid namespace-level  variables if at all possible (consider using the singleton pattern instead, creating the instance on demand).
 +
[[Category:Coding Standards]]

Latest revision as of 17:08, 14 December 2009

Avoid cross module dependencies when initializing global data. This is because the other objects might reside in a different shared library object, and order of initialization is undefined then. As a rule of thumb, avoid namespace-level variables if at all possible (consider using the singleton pattern instead, creating the instance on demand).

Personal tools