T O P I C R E V I E W |
modulus |
Posted - Aug 02 2013 : 12:01:50 PM Constructor initialization lists are a pain to maintain. The order of initialization should match the order of the members in the class definition. Usually I dont need to put all members in the initialization list, so when adding a new member I have to manually determine the order -- it's very time consuming. Another problem that crops up is making sure each member is initialize properly. I think VAX could help here, and wouldn't be too dificult.
Usage: Right click on constructor -> Refactor -> Update Initialization List ... - A dialog box appears showing all members with a check by ones already in the initializer list. You can check the members you want to add, and VAX updates the code for you:
MyClass() : MyBase(), mMember1AlreadyHere(...), mMember2AddedByVAX(/*TODO:Initialize*/), mMember3AddedByVAX(/*TODO:Initialize*/), mMember4AlreadyHere(...) { }
Even if you get the formatting wrong, it would be a huge timesaver. Just seeing the list of members not initialized is valuable on its own. |
3 L A T E S T R E P L I E S (Newest First) |
accord |
Posted - Jan 13 2015 : 6:21:15 PM I have replied in the other topic: http://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=10770 |
jwiesemann |
Posted - Dec 29 2014 : 04:28:07 AM You should really implement this. Including the update function. This is not only a convenience feature but with an easily implemented initialization list in correct order the chance for uninitialized members will be much lower. |
accord |
Posted - Aug 04 2013 : 07:49:18 AM We are considering to implement a refactoring command like this, creating a constructor initializer list from member variables:
case=10622
I have added a comment to the case explaining that it could be used to update the list with new members as well, leaving the old ones (and its values) alone, but maintaining the same order as the members have in the class declaration list. |
|
|