Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 FindReference of a static function or variable

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
xMRi Posted - Jan 18 2017 : 04:53:49 AM
When I am in a source module and I have a static function in this module, than this function can only be used and "referenced" in this module.

I.E.:
static CString Foo(PCTSTR pszText);


But the "Find Reference" function searches other files too and will find also member functions. Even if the function is declared outside of a class. So also member functions should never be found.


10   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 24 2017 : 11:49:19 AM
I have the test project, many thanks, I am looking at it now.
xMRi Posted - Jan 24 2017 : 07:22:12 AM
I just used a small program. Cut some source parts and sent the resulting (not compiling version) to your support.
You can repro the problem there.

Thanks for your always perfect support!
feline Posted - Jan 20 2017 : 3:46:16 PM
If you re-run the find references from the screen shot, do you still get the wrong results listed?

Would you be able to send me just the files that are showing these results, purely for testing purposes? I realise this is often not at all possible, but it's worth asking on the off chance it is possible. I could then try to reproduce this problem here with the same files, and if I can reproduce it, try to find out what is triggering this problem. If this is possible, please submit the files via the form:

http://www.wholetomato.com/support/contact.asp

including this thread ID or URL in the description, so we can match it up.

Alternatively, if you have the time, could you please try making a new dummy project, just adding these 4 files to it, and then doing a Find References in the dummy project, and see if Find References still lists the extra, incorrect references.

When you say "module", what do you mean? Is this a separate project in the solution? Or just a set of files that don't reference any other files in the solution? I am wondering if the "module" boundaries are obvious to the IDE / VA, or if they are more "we know they are here, but they are not explicitly stated".
xMRi Posted - Jan 20 2017 : 01:18:12 AM
The first file and list is correct.

The matches below doesn't make sense.
It was a static function in a CPP module.
feline Posted - Jan 19 2017 : 3:41:45 PM
I am still not seeing any problems here. In your screen shot, are any of the references in the first file wrong? I am assuming all of the references in the other files are wrong, but what about this?

Do you have calls to a different "GetName" function in the first file, that VA is correctly filtering out?
xMRi Posted - Jan 19 2017 : 12:26:00 PM
1. I am searching for the static GetName function in this module
2. Some of the Other GetName functions seam to be part of templates.
feline Posted - Jan 18 2017 : 7:27:41 PM
When this happens, are you triggering Find References on an instance of the static function, or on the class member function?

If you are doing the find on the static function, can you please trigger a Find References on the class member function "GetName()" and see how many references are found? Are the same, problem, references being found?

So far I cannot reproduce this problem, even getting a function to return a pointer to the class holding the duplicate function name, as shown in your screen shot. So I am wondering what I am missing about the code.

If you jump to one of the incorrect references, and place the caret into "GetName", what does VA show in the context and definition field? What happens when you press Alt-G?

I am wondering if the problem is limited to Find References, or if it will show up in other ways as well. I am also wondering if all references to GetName are being found, or only some references. If it is only some references, then perhaps there is a pattern to help explain this.
feline Posted - Jan 18 2017 : 07:22:36 AM
Dropbox is being a little tricky about showing me the image, so for easy reference here it is again:



Thank you for this, clearly my test code is not testing quite the right thing.
xMRi Posted - Jan 18 2017 : 06:54:28 AM
Here you see the search for a function called GetName.
Its the first match onb line 111

feline Posted - Jan 18 2017 : 05:41:33 AM
When member functions are being picked up, are these static member functions or just "normal" member functions? So far, doing some simple tests, I cannot get Find References to return both the static free function and a class member function with the same name. I am working with a few variations on the following test code. This code in the .h file:

static int staticMemberAndFreeTest(int nTestSize);

class testingStaticFindRefScope
{
	void simpleMember();
	int staticMemberAndFreeTest(int nTestSize);
};

and this code in the matching .cpp file:

int staticMemberAndFreeTest(int nTestSize)
{
	return 0;
}


We are considering restricting the files checked by Find References for static functions, but have wondered if checking more widely would be helpful to detect duplicate names:

case=19660

But this does assume that Find References is behaving reasonably at the moment. It sounds like it isn't for you.

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