Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Issue with parsing certain variables

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
edl_si Posted - Oct 18 2013 : 06:34:01 AM

Hi,

We have lots of unique identifiers in our code, define as 4chars i.e. 'test' as int.

For the last few months we have started having problems with Visual Assist where some (but not all) of these constants are not picked up by Visual Assist - you get the variable appear as black text, i.e. a unknown symbol - "Alt-G" on them doesn't work, they don't appear in the symbol find dialog.

Worse than this if you deal with any code that uses these symbols you pretty much have to disable Visual Assist, because it starts lagging badly when using these varriables and quite possibly ends up crashing Visual Studio.

Below is the basic code behind them - pretty straightforward really, and as some of them work I wonder if it is more the volume of them that we have that is causing Visual Assist problems rather than the macros themselves.

typdef unsigned int IDENTIFIER;

#define CONVERT_4CHAR_TO_LONG( v ) ((int)v)

#define DECLARE_IDENTIFIER(i, v) const IDENTIFIER i = CONVERT_4CHAR_TO_LONG( v )

DECLARE_IDENTIFIER( TEST_ID, 'test' );

Let me know if you need anymore information.

Thanks,
Ed.
4   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Oct 21 2013 : 2:31:57 PM
VA is designed to parse, and be active in both branches of a #if #else #endif block, since you will want VA's help when writing code inside one of these blocks, even if the code is currently inactive.

Plus its sometimes hard for VA to work out which block is the active one, especially since different blocks in a header file can be active in different cpp files in the same solution.

Normally VA just considers one definition for the macro, the first one it encounters, so I am not sure why VA got confused like this here, but as you can probably imagine, the exact details tend to matter with things like this.

I am glad you have found the code that was confusing VA, and that things are working well now, I hope they keep on working well. Obviously if you have any more problems please let us know, and we will do everything we can to help fix them.
edl_si Posted - Oct 21 2013 : 06:59:44 AM
Thanks for your quick reply.

The macro is indeed listed twice, with an #ifndef around it stop it getting defined twice.

Really the two versions were unnecessary so I have refactored the code to have one version and it appears to have fixed the problem.

Shouldn't VA use the #ifndef to be able to cope with the two versions though, rather than getting confused like this?

Cheers,
Ed.
feline Posted - Oct 18 2013 : 9:20:22 PM
Odd, I am wondering if VA is picking up more than one definition of one or more of these macros. That would explain why this only effects some variables.

Can you please try creating a new text file called "va_stdafx.h", placing it in the same directory as your .SLN file, and add the line:

#define DECLARE_IDENTIFIER(i, v) unsigned int i

making sure the file ends with a blank line. Then press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart your IDE.

This file is detected by VA, but is not part of the solution, and is used to help our parser make sense of things. This makes sure VA knows what this macro means. If you have more than one macro, add simple versions of the other ones as well. If this is down to VA getting confused about the macros, this should fix the problem.

All of this is explained in this FAQ entry:

http://docs.wholetomato.com?W302
edl_si Posted - Oct 18 2013 : 06:41:36 AM
Forgot to add this is with Visual Studio 2010 and VAX version 10.8.2001

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