Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Find references fails on member initialization

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
.oisyn Posted - Mar 26 2010 : 10:59:01 AM
If you have a class member that is initialized in the constructor using a parameter of the same name, VA X does not see that the member being initialized belongs to the class

struct Foo
{
    int bar;
    //   ^ #1

    Foo(int bar) : bar(bar) { }
    //      ^#2    ^#3 ^#4
};


If you place the cursor on 'bar' in #1, VA will not highlight #3. If you place it on #2, it will highlight both #3 and #4. This also has implications for certain refactoring operations such as Rename.

Note that this is in fact correct syntax. The C++ standard says that name lookup for member and base initialization only searches in the members and bases of the class. So the parameter 'bar' doesn't hide the member 'bar' in #3 (but it does in #4).
1   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Mar 26 2010 : 6:20:03 PM
I am seeing the same effect here. Thank you for the clear description.

case=41620

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