Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Refactor : Initialization List
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

modulus
Starting Member

1 Posts

Posted - Aug 02 2013 :  12:01:50 PM  Show Profile  Reply with Quote
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.

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Aug 04 2013 :  07:49:18 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

jwiesemann
Junior Member

14 Posts

Posted - Dec 29 2014 :  04:28:07 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 13 2015 :  6:21:15 PM  Show Profile  Reply with Quote
I have replied in the other topic: http://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=10770

Edited by - accord on Jan 13 2015 6:32:28 PM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000