Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1822: Refactoring and the scope of a variable

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
xMRi Posted - Apr 27 2010 : 07:28:18 AM
See the code sample below.
It just tried to rename the it variable in the inner loop, with the refactoring features.
The parser finds also any other it variables in the outer scope.

Is this by design and wanted?

for (TSET_IDS::iterator it=setUsed.begin(); it!=setUsed.end(); ++it)
{
	// check if only used in one context or if we
	// are about to delete this context.
	const TSET_CTableContext &setContext = mapUsage[*it];

	// We count how often this context is in use by the 
	bool bUsedOutSide = false;
	for (TSET_CTableContext::const_iterator it=setContext.begin(); !bUsedOutSide && it!=setContext.end(); ++it)
	{
		if (it->m_lIdAS!=m_context.m_lIdAS ||
		    (m_context.m_lIdPJ!=0 && it->m_lIdPJ!=m_context.m_lIdPJ) ||
			(m_context.m_lIdRL!=0 && it->m_lIdRL!=m_context.m_lIdRL))
		{
			bUsedOutSide = true;
			break;
		}
	}
}
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Apr 27 2010 : 1:40:59 PM
Unfortunately this is a known problem. It is not wanted, and it should not be by design. I think this is covered by:

case=1767

basically VA's parser sometimes gets a little confused by duplicate symbols.

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