Author |
Topic |
|
scottaronbloom
New Member
USA
2 Posts |
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! |
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
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
|
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
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. |
|
|
foxmuldr
Tomato Guru
USA
412 Posts |
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
|
Edited by - foxmuldr on Jul 15 2015 10:41:33 AM |
|
|
|
Topic |
|