Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Find References for Operators

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
eplawless Posted - May 28 2011 : 1:04:39 PM
We've been using VA X on a project with a few million lines of C++, and it's been great for performing project-wide renaming and hunting down uses of a given method. Right now, the one feature we're really hurting for is the ability to find all references to operators. For example:

struct Example {
    int operator[](const std::string &foo);
};

The ability to right click on "operator" and find all references would be wonderful. Other operators might receive similar treatment; UI-wise, I'm unsure how you'd go in the other direction (i.e. go to definition for operators) but that'd be fantastic too.

Renaming would just be icing, but we've got a real need for the find references feature.
9   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Apr 28 2016 : 8:50:50 PM
That would certainly work. It might be slow for bigger compiles, but I do remember doing this sort of thing myself in years gone by
foxmuldr Posted - Apr 28 2016 : 3:43:14 PM
quote:
Originally posted by accord
Have you tried commenting out the declaration and the definition of an operator? This way, the compiler should list you the references in the form of error messages. This remind me the old times, the pre-find references era



+1. Old school. I love it. :-)

Best regards,
Rick C. Hodgin
feline Posted - Apr 25 2016 : 1:53:20 PM
This is still something we are considering doing at some point. Sadly the speed of computers is not automatically enough. We have to write the code to do this, and we still need to watch VA's performance, since speed is still an important issue that comes up now and then. It seems computers are rarely fast enough, since there is always more for them to do.
CliffyP Posted - Apr 24 2016 : 11:56:57 AM
Id also like to see this feature made available. Its been 5 years since this request, computers are faster now!

accord Posted - May 30 2011 : 2:56:52 PM
I have put in a feature request to see what the developers make of it:

case=57778

However, don't hold your breath: I don't know how soon (if at all) it gets implemented. We have a loads of outstanding other feature requests, and we have to prioritize them somehow.
eplawless Posted - May 30 2011 : 11:54:19 AM
That's what I've been trying to avoid having to do :) Recompiling the project takes a few hours, and it'd go a heck of a lot faster if we had this feature.

We've got an in-house STL (ish?) implementation, written before they were generally reliable or efficient (some of it was written before the bool type was added to C++). Someone decided way back then to use operator() on containers to mean normal indexing and operator[] to mean indexing which would grow the container to fit the index. We're trying to get rid of operator() and modify operator[] so that it's the normal indexing operator, but we're a relatively small team (10-15 people) and need to minimize the time spent on this (and everything else). Visual Assist X has been fantastic for our previous sweeps through the (again, several million line) codebase, and I'm hoping we can use it again here.

I think this feature is useful beyond our particular case. Several times I've wanted to find references to or rename an operator (it's usually operators () and []), though I'd be hard-pressed to give you specific examples here.
accord Posted - May 30 2011 : 11:29:16 AM
*wow* Would you wait it for a weekend? Intriguing. What would you use it for? Are you using the operator for something special?
Anyway, I don't think that it is implemented already. But I'm not sure about it.

Have you tried commenting out the declaration and the definition of an operator? This way, the compiler should list you the references in the form of error messages. This remind me the old times, the pre-find references era
eplawless Posted - May 30 2011 : 11:01:11 AM
Thanks for the reply; with that rationale, disabling find references for operators is totally understandable since it would interfere with interactive use. That said, it would be really helpful if there was an option to enable it regardless, and we could let it run the search overnight (or over the weekend) (or over the whole week, if necessary). It seems as though all of the ingredients are there to have this work, and it would be extremely useful for our project. Even if it was only enabled for operators [] and () we'd be really happy.
accord Posted - May 30 2011 : 08:46:33 AM
Find references and rename on operators are disabled because it would be computationally expensive to find the references. Say, you have a + operator overloaded. + (and other operators) are very common in any source code, so we would end up with loads of stuff to examine. For functions, a find operation with "match case" and "match whole word" enabled already filters the search pretty well, so VA just needs to examine these cases. Analyzing the context and deciding whether a result is a reference or not is the slow part of the operation.

However, Visual Assist offer information and goto on a few operators. e.g. operator() and operator[] are supported. Just place the caret after the ']' and you will get context and definition field and can use goto:



The snippet itself is indeed nonsense and just to demonstrate how VA works.

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