Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Multiple iterators problems

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
bugmenot Posted - Jun 20 2014 : 10:30:32 AM
For fallowing code:

#include <vector>

struct A
{
	int a, b;
};

struct B
{
	int c, d;
};

using namespace std;

int main()
{
	vector<A> v1;
	vector<B> v2;

	for(vector<A>::iterator it = v1.begin(), end = v1.end(); it != end; ++it)
	{
		it->a = 0;
		it->b = 0;
		it->c = 0;
		it->d = 0;
	}

	for(vector<B>::iterator it = v2.begin(), end = v2.end(); it != end; ++it)
	{
		it->a = 0;
		it->b = 0;
		it->c = 0;
		it->d = 0;
	}

	return 0;
}


Writing "it->" in first loop will show sometimes that object pointed by iterator have four variables a, b, c and d; sometimes it shows that it have only c and d, and underline "it->a = 3;" as error.
Writing this in second loop will correctly show only c and d.

See screenshot and look at underline.







License: trial
VA_X.dll file version 10.8.2036.0 built 2014.05.22
DevEnv.exe version 9.0.30729.1 Professional
msenv.dll version 9.0.30729.1
Font: Courier New 13 (pixels)
Comctl32.dll version 6.10.9200.16384
Windows 8 6.2 Build 9200
4 processors (x86-64, WOW64)
Language info: 1250, 0x415

Platform: Win32
Stable Includes:
c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\include;
c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\include;
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;
C:\\Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Include;
C:\\Program Files (x86)\\Visual Leak Detector\\include;

Other Includes:

Stable Source Directories:
c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfc;
c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfcm;
c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\atl;
c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\crt\\src;



IDE: Visual Studio 2008
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jun 27 2014 : 12:10:45 AM
I am seeing the same effect here. Thank you for the clear description.

case=11502

As you will have realised, VA is getting confused with the same variable name being reused to mean something different inside the same function.

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