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
 1442: #define and the Goto feature
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

zworg
New Member

9 Posts

Posted - Mar 17 2006 :  06:07:37 AM  Show Profile  Reply with Quote
VC++ 6 IDE

// test.c
#include <stdlib.h>

#ifdef SOMETHING
#define malloc(x) somethingelse(x)
#endif

int f()
{
   malloc(10);
}

Note: symbol SOMETHING is *not* defined
Put the caret on 'malloc' from the malloc(10) line.

1) Alt+G shows 3 locations for me:
crtdbg.h
malloc.h
stdlib.h
Why test.c is not listed there (even if I remove #ifdef/#endif)?

2) The Definition field (and the tooltip shown when you type '(' after malloc) shows only one definition
#define malloc(x) somethingelse(x)

However, if I delete the #define malloc line and save the file the Definition field and the tooltip get 'fixed', i.e. they will display 3 alternative definitions from the above 3 locations.

support
Whole Tomato Software

5566 Posts

Posted - Mar 18 2006 :  6:23:29 PM  Show Profile  Reply with Quote
The presence of #ifdef is immaterial to VA X. Our add-in will parse and "know" all code inside #ifdef and #else clauses, creating many situations in which you have multiple definitions for a symbol. This is by design, and done since you want VA X help when you're editing the #ifdef clauses, and the #else clauses.

That said...

We can reproduce the inconsistency between the Definition field and the Alt+G list. It appears our code which builds the Alt+G list ignores preprocessor macros in certain circumstances (after reopening a workspace in vc 6; after rebuild of a symbol database in vs.net)

If you type:

foo(){
return 0;
}
main(){
foo();
}

... and place your caret on foo within main(), Alt+G takes you to the implementation of foo. If you add a #define to override foo, the same Alt+G takes you to the #define. If you reopen your workspace in vc 6, or rebuild your symbol database in vs.net, the same Alt+G takes you again to the implemention. You expect to go to the #define.

case=1039
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