On 18 September 2017 at 10:36, Lars Knoll <[email protected]> wrote: >>> But for new plugins that target a known platform that supports c++11, they >>> can most likely use new conventions. >>> Unless someone can come up with technical reasons the new c++11 member >>> initialization is better than what is there now, I’d rather keep it the >>> same as it is now. >> >> If you have more than one constructor that set a member to the same >> value, it's arguably simpler and less error-prone >> to use a member initializer. > > I also think that we should be using member initialisers when writing new > code (or when refactoring existing code). But doing a global search/replace > of existing code might lead to subtle errors as it's easy to miss the rare > case when different constructors initialise members differently.
Note that if you have both a member initializer and a ctor-initializer (the colon-list after the constructor signature, X() : foo(a), bar(b)), the ctor-initializer is used. It is non-trivial to remove ctor-initializers and replace them with member-initializers, I don't know whether the clang-tools can do that. _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
