Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Rename - member and constructor identical name

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
Marco123 Posted - Apr 17 2015 : 09:16:22 AM
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.
2   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Apr 17 2015 : 5:47:19 PM
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.
Dusan Posted - Apr 17 2015 : 11:36:09 AM
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;



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