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
 For loop declarations confused
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

yym
Senior Member

Israel
31 Posts

Posted - Aug 16 2010 :  08:16:26 AM  Show Profile  Reply with Quote
build 1823, VS2008

When the same variable name is used in two for loops, VA sometimes gets confused about which is which. It only happens with fairly complex declarations.

In the code below, VA thinks the x in line A is the one in the second for loop (it shows it in the context field, shows its member, underlines the aaa).

#include <vector>

struct Aaa
{
	int aaa;
};

struct Bbb
{
	int bbb;
};

std::vector<Aaa> a;
std::vector<Bbb> b;

int main()
{
	for (vector<Aaa>::iterator x = a.begin(); x != a.end(); ++x)
	{
		(*x).aaa; // line A
	}

	for (vector<Bbb>::iterator x = b.begin(); x != b.end(); ++x)
	{
		(*x).bbb;
	}
}

yym
Senior Member

Israel
31 Posts

Posted - Aug 16 2010 :  08:26:11 AM  Show Profile  Reply with Quote
Actually it happens in simple cases as well, it's just not so obvious because of the lack of squiggles and VA manages to show all the members. In the following case, putting the cursor on the y on line A and doing Alt-G shows both declarations.

int main()
{
	for (double y;;)
	{
		y; // line A
	}

	for (int y;;)
	{
		y;
	}
}
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Aug 17 2010 :  03:51:00 AM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=9362

Turning on

VA Options -> Advanced -> Listboxes -> Get content from default Intellisense

can be a good workaround for the suggestion problem.

Edited by - accord on Aug 17 2010 04:05:17 AM
Go to Top of Page

yym
Senior Member

Israel
31 Posts

Posted - Aug 17 2010 :  04:15:13 AM  Show Profile  Reply with Quote
"Get content from default Intellisense" doesn't really help me because Intellisense is hopelessly confused in my project.
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