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
 Feature Requests
 Confused by #undef's
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dhoffman
New Member

5 Posts

Posted - Feb 26 2012 :  10:33:02 PM  Show Profile  Reply with Quote
I've noticed that VAX gets confused if you have #undef's in your code. E.g.:

#define someConstant someValue

...several pages worth of code, including reference(s) to someConstant...

#undef someConstant

If you scroll down in the code to where the #undef is showing, then back to where the constant is used, it gets underlined as an undefined variable. Scroll back up to where it was #define'd, and it's fine. Keep in mind this is without any typing or mouse clicking at all. Just scrolling so that the #undef or #define is visible on the screen causes its behavior to change. Seems like it should be an easy fix, but I don't know...

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Feb 29 2012 :  11:32:49 PM  Show Profile  Reply with Quote
Which IDE and version of VA are you using? So far I am not seeing any sign of this problem using VS2008 and VA 1901.

As for undef, since macros are not tied to any normal C++ scope undefining or changing the definition of a macro at an arbitrary location can confuse our parser, since we don't have the luxury of running the code through a full pre-processor before trying to make sense of it. So this will probably be a fairly hard problem.

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

dhoffman
New Member

5 Posts

Posted - Mar 01 2012 :  3:25:47 PM  Show Profile  Reply with Quote
VAX version 10.6.1862.0
VS 2003 (doing original X-Box development, which they stopped supporting after 2003.) I also have 2010, but I'd need to check if it occurs there as well.

As for use of #undef, I'm not doing anything too fancy. I just sometimes need to have things #define'd only for a single file, and not in other files, so I'll have #undef's at the bottom of the file to avoid any complications that would occur if those definitions were carried over. I can see how it could get complicated with nested preprocessor stuff and possibly things defined in other files and what-not.

2010 is actually pretty good at determining what is and is not defined on its own. (You can see it grey-out code skipped by #ifdef/#ifndef's for example.) 2003 doesn't have that functionality, but VAX does seem to give you some of that. Don't know about 2005 or 2008, though.

Edited by - dhoffman on Mar 01 2012 3:28:22 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Mar 02 2012 :  6:39:24 PM  Show Profile  Reply with Quote
So far I cannot reproduce this underlining problem here. Would it be possible to get a copy of a file that shows this problem, just for testing purposes? This is often not possible, but it is worth asking on the off chance.

If so please submit the files via the form:

http://www.wholetomato.com/support/contact.asp

including this thread ID or URL in the description, so we can match it up.

VA does not attempt to grey our or mark inactive code, in fact VA is designed to be active even in inactive code, so as to help you working with inactive code. So if you are seeing inactive code greyed out aI am not sure where this effect is coming from, if not from the IDE.

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

dhoffman
New Member

5 Posts

Posted - Mar 02 2012 :  9:45:26 PM  Show Profile  Reply with Quote
Inactive code is greyed out only in 2010. In 2003 I don't get that. I assume this is a feature of VS itself, because it did this even before I installed VA. Anyhow, I was trying to find the file I was having this problem with before, but either the problem has since fixed itself, or I've somehow since factored out whatever was causing the problem, because I'm not seeing it anymore. At any rate, it probably wouldn't do you much good unless I sent you the entire code-base (including vendor-libraries), because there's a lot of dependency going on. If it helps any, I think the defines in question were for a templated hash-map class. The lines are:

#define TEMPLATE_TYPE template <typename TKey, typename TData, typename HashFunctor>
#define HASH_TYPE HashMap<TKey, TData, HashFunctor>
#define ITERATOR_TYPE HashMap<TKey, TData, HashFunctor>::Iterator

And a typical usage might be something like:

TEMPLATE_TYPE typename ITERATOR_TYPE HASH_TYPE::Begin()
{
...code...
}
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Mar 02 2012 :  11:23:01 PM  Show Profile  Reply with Quote
Given these examples, so I can see the sort of thing you were doing, I am guessing that something was confusing our parser, and the #undef may simply have been present, but not a significant factor.

It is good that the underlining has gone away. Hopefully this problem will stay fixed. Obviously if it comes back again please let me know and I will do what I can to try and find a solution.

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