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
 completion list for C++ c'tor initializer list
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

steerpike
New Member

Germany
3 Posts

Posted - Aug 17 2005 :  05:58:58 AM  Show Profile
Hello,
I'm new to VAX and happy with it's features that helps me in my C++ programming in VS6.

But in my first experiences with VAX, I definitely missed a completion list feature for constructor initializer lists, during writing their definitions. That means, after typing the colon, no list is shown for the class member variable names and the constructor of a base class.

Example:

// given this declarations
struct ABase
{
ABase(int i);
int aVar_;
};
struct BDerived : public ABase
{
BDerived( int i, bool b );
bool bVar_;
};

// if I now type the constructor definition, the completion list
// for the constructor name and arguments are OK thus far...
BDerived::BDerived( int i, bool b ) :
// but after typing the colon nothing of VA help comes,
// so I must find out all the names manually (or at least the first
// characters to have a suggestion list)
ABase( i ), bVar_( b )
{}

Besides this, I would like a feature that includes the whole initializer list automatically after typing the colon (of course in the right order of their declaration), so I must only add parentheses and the initializing variables to them if necessary.

with kind regards.

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Aug 17 2005 :  5:02:00 PM  Show Profile
i can see a possible problem with automatically listing all member variables after the constructor, since i often rely on the default constructor when using string member variables.

the idea to automatically insert the parent class constructor is certainly an interesting idea. however what would you expect VAX to do if the base class had more than one constructor?

class ABase
{
    ABase(int i);
    ABase(void *a, void *b, void *c);
    int aVar_;
};


i suppose you could have VAX pop up a list of all base class constructors, and you pick the one you want inserted, but i am not sure about this idea myself. some library classes i use a lot as base classes have 10 or more constructors.

zen is the art of being at one with the two'ness
Go to Top of Page

steerpike
New Member

Germany
3 Posts

Posted - Aug 18 2005 :  06:02:50 AM  Show Profile
quote:
I can see a possible problem with automatically listing all member variables after the constructor, since i often rely on the default constructor when using string member variables.


In this case, listing them is maybe redundant, but not wrong.

class A
{
std::string name_;
int a_;
public:
A() : name_(), a_() // this list is without any costs
{}

A(void *a, void *b, void *c);
};


All in all, I would prefer a popup-listbox that includes an entry for each class member variable and one entry for each base class to choose a specific one, plus a special entry "all" to have a complete automatic listing of all of them, separated with commas and with empty parentheses after anyone. If you have:

class B : public A
{
B() : A() {}
int bVar_;
};

the popup-list after typing the colon must include only entries for A, bVar_ and 'All'. If the member variables in the base class are declared as public or protected, they must also be included in the popup list.

If the base class have multiple constructors it must be nevertheless included once in the list (without arguments), since you choose the correct one later after typing the opening parenthesis or typing inside the parentheses, filling them with initializers. In this case VA could pop up a second list with the possible constructor variants available, but I think this is a separate field, since VA also does not handle overloaded functions in this way, which are a similar case:

void func( bool );
void func( float, int );
void main() {
func( // no list, only the first function signature appears now)
);
}

In summarize, for a simple initializer popup-list, it is sufficient to deal with the name of base class constructors, which is the same in case of multiple constructors (only their parameter signature differs).

Further I think, if you choose an entry (except the 'All' entry) from such a VA popup list, VA should take it and also automatically add the parentheses after it, then you can type a comma and become a new popup-list with the remaining (or all) entries and so on.

Greetings
Go to Top of Page

steerpike
New Member

Germany
3 Posts

Posted - Aug 18 2005 :  06:08:13 AM  Show Profile
Sorry for my code without indentation, but I have now discovered, that I can use the 'insert code' format button for this.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Aug 18 2005 :  3:22:44 PM  Show Profile
i see what you are getting at, but this is definitely starting to sound a little complicated. the basic idea of having VAX suggest the base class name certainly makes sense.

what do other people think about this? any thoughts?

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000