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 does not work with constructors

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
XMi Posted - May 12 2015 : 02:31:48 AM
Hi.

I noticed a few problems with the Find References. It does not work properly with constructors, destructors and overloaded operators.

In the sample code below, if I run 'Find References' on one of the constructors or the destructor, VA list me all the occurrences of the class name. If I run it on operator=(), I get an error message "Find References is not available because the symbol is unrecognized."

Regards,
Xavier


#include <iostream>
#include <string>


class Foo 
{
public:
   Foo(std::string const& name);
   ~Foo();
private:
   Foo(Foo const& ref);
   Foo& operator=(Foo const&);
   std::string name_;
};


Foo::Foo(std::string const& name)
   : name_(name)
{
}


Foo::~Foo()
{
}


Foo::Foo(Foo const& ref)
   : name_(ref.name_)
{

}


Foo& Foo::operator=(Foo const& ref)
{
   name_ = ref.name_;
   return *this;
}


int main(int argc, char* arg)
{
   Foo("bar");
   return 0;
}


My setup:
VS2013 Pro
Windows 8.1 Pro 64bit EN
VA build 2062
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - May 13 2015 : 11:05:54 PM
This is a good point, and we may well do something like that when we try allowing Find References to pick up constructors. Hopefully what we do will be reasonably robust before being released, but there are always edge cases if you know where to look.
XMi Posted - May 13 2015 : 12:55:20 AM
Hi.

I knew what I asked was tricky, and thank you for your answer. mostly because of the implicit calls made to those functions. Yesterday I noticed you put a warning in the 'Change Signature' dialog when calling it with a constructor. Maybe you could put a similar warning in the 'Find Reference' window: "Here are the explicit calls we could find, but there may be some implicit call to this function.

feline Posted - May 12 2015 : 10:43:39 PM
Find References on the constructor returning all references to the class is currently expected behaviour. We are considering a change to how Find References handles constructors, the trick is to pick up all of the spots where a class instance is being constructed:

case=1262

You also mention destructors. What are you expecting to happen here? Sometimes the destructor is called when the class instance goes out of scope, so there is no explicit reference to try and find here.

Better handling of overloaded operators is also something we are considering, but if anything this can be even more tricky than constructors, depending on which operator has been overloaded:

case=57778

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