View Issue Details

IDCategoryLast Update
0004876features2012-05-21 09:18
ReporterelfringAssigned Topaul 
Reproducibilityalways 
Status resolvedResolutionwon't fix 
Product Version 
Fixed in Version 
Summary0004876: Improve implementation of constructors
DescriptionI have noticed that some assignments are used in the constructor bodies.

Examples:
http://viewcvs.ardour.org/index.cgi/ardour2/ardour2/branches/3.0/libs/ardour/audioengine.cc?revision=12069&view=markup
http://viewcvs.ardour.org/index.cgi/ardour2/ardour2/branches/3.0/libs/ardour/playlist.cc?revision=12131&view=markup
http://viewcvs.ardour.org/index.cgi/ardour2/ardour2/branches/3.0/libs/ardour/session.cc?revision=12084&view=markup

The recommended way for performing efficient construction is to use the initialisation list.
Additional Informationhttp://dietmar-kuehl.de/mirror/c++-faq/ctors.html#faq-10.6
http://cprogramming.com/tutorial/initialization-lists-c++.html
http://goingware.com/tips/parameters/membervars.html
http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=15&rl=1
http://www-h.eng.cam.ac.uk/help/importedHTML/languages/C++/Thinking_in_C++/tic0094.html
TagsNo tags attached.

Activities

paul

2012-05-21 09:18

administrator   ~0013268

patches to change this would be welcome, but the overhead involved here is absolutely minimal (almost all of the affected variables are scalar, so there is no/almost no object construction going on) and the classes most affected are long lived and not often created. Notice, for example, that Regions use initialization lists exclusively.

i'm going to mark this as WONTFIX but that just means that i have no plans to change the code. patches would still be welcome if anyone wants to create them and attach them to this bug.

Issue History

Date Modified Username Field Change
2012-05-13 10:03 elfring New Issue
2012-05-13 12:24 cth103 cost => 0.00
2012-05-13 12:24 cth103 Status new => confirmed
2012-05-13 12:24 cth103 Target Version => 3.X
2012-05-21 09:18 paul Note Added: 0013268
2012-05-21 09:18 paul Status confirmed => resolved
2012-05-21 09:18 paul Resolution open => won't fix
2012-05-21 09:18 paul Assigned To => paul