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
 Technical Support
 Rename - member and constructor identical name
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Marco123
New Member

9 Posts

Posted - Apr 17 2015 :  09:16:22 AM  Show Profile  Reply with Quote
When I'm using the renaming feature (Refactor->Rename) on a struct that has an identical name for the member variable and the corresponding constructor parameter, it doesn't work as expected.

1:typedef struct S {
2:	void* pointer;
3:
4:	S(void* pointer)
5:		: pointer(pointer) {}
6:} S, *PS;


If I use the rename feature on the member variable (line 2) only the member variable (line 2) is renamed.

If I use the rename feature on the constructor parameter (line 4) the member variable at line 5 is renamed, too.

Dusan
Whole Tomato Software

Slovakia
177 Posts

Posted - Apr 17 2015 :  11:36:09 AM  Show Profile  Reply with Quote
Even the syntax is legal, it is considered as bad practice.

I think that VA is confused of the name of parameter as it has same name as initialized variable.
If I change passed parameter name to p, all works fine for me:

typedef struct S {
	void* pointer;

	S(void* p)
		: pointer(p) {}
} S, *PS;


Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Apr 17 2015 :  5:47:19 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clean description.

case=41620

For now, you can use different names as Dusan has explained.
Sorry for the inconvenience.
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