Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Find references bug(?) with struct fields
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mvolkar
Junior Member

20 Posts

Posted - Sep 14 2017 :  09:01:09 AM  Show Profile  Reply with Quote
Consider the following C code:


typedef struct
{
	unsigned int field1;
} struct1_t;

typedef struct
{
	double field1;
} struct2_t;


int main()
{
	struct1_t varOfType1;
	struct2_t varOfType2;

	varOfType2.field1 = 7.0;
	varOfType1.field1 = 3;
}



If I select field1 and perform a Find References with Visual Assist, it returns references to the field of the same name from both structures. This makes Find References virtually useless for a large project with many duplicate struct field names.

I have found that this does work correctly if the structs are named. I was a bit surprised by this though, since the two variables are of different types, and regardless of whether the struct has a name or not I would have expected Visual Assist to be able to differentiate between the references.

Is this a bug? Or do we need to change our coding style to make sure structs like this always have names?

I don't think it matters, but I'm using Visual Studio 2015 with Visual Assist build 2212. I also have a simple dummy solution that reproduces this, if it would be helpful.

ChrisG
Whole Tomato Software

USA
299 Posts

Posted - Sep 14 2017 :  3:24:46 PM  Show Profile  Reply with Quote
Hello mvolkar,

I'm sorry you are having this problem. I was able to reproduce the issue and have opened a case (111089) so that we can get this resolved.

Thank you for taking the time to report the issue in a clear way.
Go to Top of Page

mvolkar
Junior Member

20 Posts

Posted - Sep 22 2017 :  2:21:03 PM  Show Profile  Reply with Quote
Thanks for the confirmation. Is there any way for me to track the progress of a fix for this? We're currently considering whether to change our style guidelines to always provide names for structs simply to work around this issue. I'm generally not a big fan of that solution, though.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Sep 23 2017 :  09:30:52 AM  Show Profile  Reply with Quote
Unfortunately there isn't any progress to report on this yet. We have quite a few outstanding bugs to address, so I don't know when or if we will get to fix this. While I appreciate that changing your code is not helpful, it may be the fastest and most reliable solution for now. Can you at least find all of the effected structures with a regular expression search? It looks like the regular expression:

^[ \t]*typedef[ \t]+struct[ \t\r\n]*{


should catch nearly all of these.

zen is the art of being at one with the two'ness
Go to Top of Page

kimbo
Senior Member

33 Posts

Posted - Sep 27 2017 :  2:09:40 PM  Show Profile  Reply with Quote
Hello, in my company we are waiting for this feature since years :)

If the method/member name is unique "Find reference" works well, but don't search for struct members like "flags" or methods like "update". It looks like "Find reference" does a text search instead of using the sematic information it should have.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Sep 27 2017 :  6:03:11 PM  Show Profile  Reply with Quote
Find References is designed to use semantic information. Does Find References always produce the wrong results for you on symbol names that are not unique, or only some of the time?

Does this problem effect all struct's, or only those that only have a name at the end? Using the following simple test, Find References is working as expected for me with this code:

struct testFindOne
{
	int flags;	// inside struct one
};

struct testFindTwo
{
	int flags;	// inside struct two
};

void testFindRefStructMember()
{
	testFindOne testOne;
	testFindTwo testTwo;
	// runing Find References on these two struct members
	// returns the correct references only
	testOne.flags = 1;
	testTwo.flags = 2;
}

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000