Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Fixing constructor initializers

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
scottaronbloom Posted - Jul 14 2015 : 1:05:46 PM
I often find, constructors with issues.

The first is this.
A::A(..):base(),m_1(...), m_2(..)

Where every initialized variable and the base class are on the same line. I hate it.. Some like it.. Is there a way to add this to the reformatting option set?

The second, is for fixing the following bug:
class foo
{
public:
foo( int val ) :
_b( val ),
_a( _b + 1 )
{
}
int a() const{ return _a;}
int b() const{ return _b;}
private:
int _a;
int _b;
};

Where _a is initialized out of order from _b. This is a warning on gcc (-Wreorder) but is not a warning in Visual Studio.

Having the ability to refactor the order of iniitalized variables would be amazing!
3   L A T E S T    R E P L I E S    (Newest First)
foxmuldr Posted - Jul 15 2015 : 10:36:30 AM
NetBeans with C++ has a good code formatter. It is highly configurable. You can install NetBeans 8.x with C++ and have an instance open with a new C++ document. Whenever you need to format something, copy-and-paste, apply formatting, then copy-and-paste back. It fixes up 95% of issues and has some abilities to parse variables. I personally prefer the ANSI C setting with some tweaks.

Best regards,
Rick C. Hodgin
accord Posted - Jul 14 2015 : 8:01:39 PM
*ah* My comment is to sort alphabetically, not due to the same order as how listed in the class. We are considering to implement a refactoring command to create/update initializer lists:

case=10622

With this command you would be able to modify it's refactoring snippet as well, which should also solve your formating request.
accord Posted - Jul 14 2015 : 7:57:32 PM
We don't really do code formatting, we just have settings and snippets for existing refactoring features, for example.

The second: you can already do this if every variable is on a different line. You just need to select the lines and select:
VASSISTX -> Tools -> Sort selected lines


© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000