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 confused

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
jschroedl Posted - Nov 02 2006 : 12:08:09 PM
(Hi there, VAX 14-day trial newbie here so apolgies if this is old news; my search attempts didn't find anything related):

int foo;
void testFindReferences()
{
   foo = 3; // Find refs on me finds foo below, not above.

   int foo;
   foo = 4;
}


And doing a find references on the outer foo shows no refs, but on the inner foo it locates the int foo below it as a ref. Seems like a bug.

John
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Nov 03 2006 : 08:30:27 AM
A couple of tests on a switch statement, with brackets and local variables inside the two cases are not showing any problems.

If you run into this problem again any clues as to the cause would be appreciated.
jschroedl Posted - Nov 02 2006 : 8:12:10 PM
We do not see this often in the code. In fact, every case I've encountered has been a bug in our code and is always the result of a second developer inheriting the code and not realizing the earlier 'foo'. Default VS compiler warnings don't flag this though I'm attempting to move everyone to /W4 and/or /analyze builds.

I encountered this b/c I've been going through the PREfast (Team System Static Code Analysis) warnings report for our project. I was attempting to rename the inner foo to something different with the VA Rename refactoring when I noticed it marked the incorrect items. This made me a little wary of the Rename refactoring.

I agree, code of this nature should not be in the project as it can cause bugs.

I noticed a similar bug with the references picking up items from an earlier scope but did not create another test case -- I believe the earlier scope was in a case statement. Something like:

{
case 1:
{
int bar;
. . .
}

case 2:
{
int bar;

bar = 5; // I believe highlighting refs on this picked up bar from an earlier case as well.
}

I didn't isolate it to a repro test case but will keep an eye out for it.


John
feline Posted - Nov 02 2006 : 3:16:04 PM
That's a bug.

case=3414

Do you see this sort of thing often in your code? It has the potential to be very confusing!

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