MantisBT - CMake
View Issue Details
0011683CMakeDevelopmentpublic2011-01-11 08:442011-01-11 08:59
Markus Elfring 
Brad King 
normalminoralways
closedno change required 
CMake 2.8.3 
 
0011683: Improve implementation of constructors
I have noticed that some assignments are used in the constructor bodies.

Examples:
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmCacheManager.cxx;hb=a2a997d8c479e2b0a56354ef107239f550117c44#l36 [^]
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmXCodeObject.cxx;hb=a8ded5338bf44173fe33e0249ab14aa3d8e7540c#l36 [^]
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/kwsys/Glob.cxx;hb=f9687e328f7ea64ea6384aae11af36fdd3a12643#l59 [^]

The recommended way for performing efficient construction is to use the initialisation list.
http://dietmar-kuehl.de/mirror/c++-faq/ctors.html#faq-10.6 [^]
http://cprogramming.com/tutorial/initialization-lists-c++.html [^]
http://www.eng.cam.ac.uk/help/tpl/languages/C++/Thinking_in_C++/tic0143.html [^]
http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=15&rl=1 [^]
http://goingware.com/tips/parameters/membervars.html [^]
No tags attached.
Issue History
2011-01-11 08:44Markus ElfringNew Issue
2011-01-11 08:59Brad KingNote Added: 0024576
2011-01-11 08:59Brad KingStatusnew => closed
2011-01-11 08:59Brad KingAssigned To => Brad King
2011-01-11 08:59Brad KingResolutionopen => no change required

Notes
(0024576)
Brad King   
2011-01-11 08:59   
We are competent C++ programmers and are familiar with such issues. Every real-world project has unlimited ways of improving its code style with no change in functionality, but no one has time to make everything perfect everywhere.