T O P I C R E V I E W |
asmcoder |
Posted - Jan 05 2012 : 03:37:14 AM hi,
i am using VS2008 (c++) and VAX 10.6.1862. The option "local symbols in bold" apparently doesnt only mark function-local variables in bold, but also external and filescope ones.
I think this was different in the past and helped me a lot to diff. between function-local and external variables.
What can i do to bold only function-local variables? |
9 L A T E S T R E P L I E S (Newest First) |
accord |
Posted - Jan 23 2012 : 1:33:58 PM Thank you for the code snippet. I've been doing some tests using it, but the farthest I could get was that it took a few hundred milisec. to switch to non-italic. But always does the same and only once. Are you able to reproduce the problem using a clean new win32 test project?
quote: Especially because if I use the command "Goto Implementation" I go direct to the correct symbol in the stable (MFC-file).
Alt+G uses a more deep context analyzing. But in a single screen there may be hundreds of symbols to color, and when you hold down page down in a larger file, it must do the same 20 or 30 times in a second. And some use large resolution or portrait monitor so this number can even be higher. |
azur |
Posted - Jan 20 2012 : 02:01:33 AM The switching stops eventually. Sometimes 'normal' and sometimes 'stable' "wins".
This thing looks like the behaviour you described for the local symbols marking. But in this case it's looks more odd because many names are shown as 'normal' but expected to shown as 'stable'. For excample CListSomething::GetNext. In many files GetNext is stable and in some files are not. (and yes, in one class I have a method with the same name).
I understand the performance problem. But I don't have expected that stable mean "the one and only symbol found that, in addition, is implemented in the stable directory". Especially because if I use the command "Goto Implementation" I go direct to the correct symbol in the stable (MFC-file).
In this moment I see a thing that you, most likely, can reproduce. H-File:
typedef struct tagDATA
{
DWORD nSize;
UINT nID;
...
} scDATA;
CPP-File:
scDATA data;
data.nSize = sizeof( scDATA );
...
"nSize" is shown in the CPP-File as 'stable'. And if you edit near "nSize" in the CPP-File you can see a switch from 'stable' to 'normal' to 'stable'.
|
accord |
Posted - Jan 19 2012 : 7:06:07 PM Does the "switching" stops eventually? Theory - If VA parses normal symbols and then stable ones or the other way around, with some duplicate names, I can imagine that it will use the latest type, so it may switch style even when you don't edit the file. |
azur |
Posted - Jan 18 2012 : 01:49:37 AM Now I know this behaviour and I can see it as a feature.
By the way - did you have a explanation for following behaviour? I have turned on "Stable symbols in italic". After opening a file sometimes some names switches many times from "normal" to "stable". I understand that you parse the file in the background. But if I do nothing (no typing, no scrolling) I expect that the presentation only switch once.
|
accord |
Posted - Jan 17 2012 : 7:17:17 PM Thank you for the clarification. Visual Assist's syntax coloring doesn't do full context check. It's optimized for speed so it can cope with fast scrolling. As you have already observed, VA will store symbol coloring on a pre-file basis. This is a simplification, but it rarely causes problems for me. Using a type as a variable name is not common as far as I know. (and was a mistake in your case) |
azur |
Posted - Jan 17 2012 : 02:08:25 AM With VC 9 and VC 10 (both with warning level 4) you can compile the code.
I found the issue during adapting our source from 32 Bit to 64 Bit. (many changes from "int" to "INT_PTR").
Near the end of a file with 10.000 lines was a piece of code like this: int nAnswer = CMyDialog(this).DoModal(); To make the compiler happy (-warning C4244) I double click "int" and change it to "INT_PTR". But in this case I double clicked "nAnswer" and change it to "INT_PTR" - without noticing. The project compiled without errors and everything was fine. Later I opened the file again and the "INT_PTR"-type shown as local symbol. I tried VAssist "Rebuild Symbol database", "Clear History, cache and temporary files" and so on. Finally I detect that you probably have a buffer for "local symbols" on file level and not, as I expected, on function level. |
accord |
Posted - Jan 16 2012 : 12:51:07 PM Yes it's unexpected, but it won't compile, will it? |
azur |
Posted - Jan 16 2012 : 05:01:06 AM I found a problem that is maybe related to the topic.
If you declare somewhere in the current file a variable with the name of a type this type is always shown as local variable in the current file.
Example:
UINT_PTR add10( INT_PTR i_nValue )
{
UINT_PTR o_nResult = i_nValue + 10;
return (o_nResult);
}
UINT_PTR add20( INT_PTR i_nValue )
{
UINT_PTR uINT_PTR = i_nValue + 20;
return (uINT_PTR);
}
Now refactor "uINT_PTR" in "add20" to "INT_PTR" and the type "INT_PTR" is shown as local variable.
This is unexpected. |
accord |
Posted - Jan 09 2012 : 3:13:08 PM Visual Assist should "use bold to highlight symbols defined in the current file." (from tooltip)
External variables, however, shouldn't be bold. I did a little experiment:
What do you mean by external? I put "int Apple;" to ext.cpp and "extern int Apple;" to ext.h and included ext.h to a different cpp file and used Apple in that cpp, but it wasn't bold. Can you please give me an example situation when it doesn't work correctly? |