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
 Local variable in C++ colored as a method
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

JakubH
Junior Member

10 Posts

Posted - Oct 20 2015 :  07:32:05 AM  Show Profile  Reply with Quote
I have quite strange issue here. Local variables in C++ are sometimes highlighted in a different color depending on a name of other local variable!
See this screenshot:


The vectors "a" and "b" are colored as a method in the third and fourth cases, where the only difference among all those examples is a different name of a local constant.
Why is that?

My setup:
VA_X.dll file version 10.9.2048.0 built 2014.09.22
DevEnv.exe version 10.0.40219.1 Professional
msenv.dll version 10.0.40219.1
Comctl32.dll version 6.10.7601.18837
Windows 7 6.1 Build 7601 Service Pack 1
4 processors (x86-64, WOW64)
Language info: 1250, 0x405


Edited by - JakubH on Oct 20 2015 07:33:19 AM

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Oct 20 2015 :  1:48:30 PM  Show Profile  Reply with Quote
Are these 4 test functions in the same file or solution?

Normally a colouring problem like this is caused by the same symbol name being used for 2 different things in the same solution. So a function a() and a local variable a in the same project can trigger this. But if your test cases are in the same file or solution then that does not fit this pattern.

zen is the art of being at one with the two'ness
Go to Top of Page

JakubH
Junior Member

10 Posts

Posted - Oct 22 2015 :  05:17:06 AM  Show Profile  Reply with Quote
It is the same function. I have just changed that one identifier for those four screenshots. Strange is, that I change a completely unrelated symbol. The only relation is that I use it on a same line.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Oct 22 2015 :  5:14:18 PM  Show Profile  Reply with Quote
I thought that might be the case, but was hoping it was as simple as different files. I would not expect this change to have this effect on the colouring.

If you place the caret either side of the variables "a" or "b", what does VA show in the context and navigation fields? These are normally at the top of the editor window, and are where the Alt-M list appears from. Are you seeing the information about the local variable, or some information about some function? What does alt-g on the variables do?

Normally colouring problems just effect the colouring, but its worth checking in case anything else is going wrong here.

zen is the art of being at one with the two'ness
Go to Top of Page

JakubH
Junior Member

10 Posts

Posted - Oct 26 2015 :  04:37:48 AM  Show Profile  Reply with Quote
It is a bit different actually:



ALT+G works correctly in both cases.
ALT+SHIFT+G works for the case with correct coloring, and does nothing for the wrong case.

Here is the full code, if it helps:
#include <vector>
#include <algorithm>

using namespace std;

void Print(const vector<double> &vect)
{
	for (size_t i = 0; i < vect.size(); i++)
		printf("%.0f ", vect[i]);
	printf("\\n");
}

int main()
{
	const int COUNT = 3;
	vector<double> a(COUNT);
	for (size_t i = 0; i < a.size(); i++)
		a[i] = COUNT - i;
	Print(a);
	return 0;
}

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Oct 26 2015 :  9:00:43 PM  Show Profile  Reply with Quote
Well, that's odd. Thank you for the clear code, I am seeing the same problems with the Context field and Goto Related. Still no sign of the colouring problem here, but colouring can be effected by various surrounding things. I have no idea what might be triggering this, I really would not expect the name of a const to have an effect like this:

case=92966

Hopefully you are not seeing too many other cases where this happens.

zen is the art of being at one with the two'ness
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