Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 For loop declarations 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
yym Posted - Aug 16 2010 : 08:16:26 AM
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;
	}
}
3   L A T E S T    R E P L I E S    (Newest First)
yym Posted - Aug 17 2010 : 04:15:13 AM
"Get content from default Intellisense" doesn't really help me because Intellisense is hopelessly confused in my project.
accord Posted - Aug 17 2010 : 03:51:00 AM
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.
yym Posted - Aug 16 2010 : 08:26:11 AM
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;
	}
}

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