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
 1711: Parser problem with pointer size qualifier
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pbrown
Senior Member

USA
44 Posts

Posted - Jan 28 2009 :  12:13:45 PM  Show Profile  Reply with Quote
I'm running VAX build 1711 with VS2008, and the parser is having problems with some of my code that uses pointer size qualifiers. Visual C++ supports "__ptr32" and "__ptr64" pointer size qualifiers, as described at:

http://msdn.microsoft.com/en-us/library/aa985900(VS.80).aspx

This construct is a niche feature that appears mainly useful to system software and other code spanning the 32- and 64-bit worlds. For better or worse, I code that needs to handle such cases. :-)

The VAX parser seems to be able to deal with this qualifier on pointers to basic data types, but not with function pointers. In the following code:

typedef struct {
    int (*__ptr64 functionPointer);
    int *__ptr64 plainOldPointer;
    int justAnInteger;
} Structure;

void junk(Structure *x)
{
    printf("%d %d %d\\n", (*x->functionPointer), x->plainOldPointer, x->justAnInteger);
}

VAX underlines both instances of "__ptr64" and both instances of "functionPointer". "plainOldPointer" and "justAnInteger" are displayed in bold as known symbols, and "goto definition" works fine on both. VAX doesn't grok the definition of "functionPointer", so "goto definition" and (more importantly) "find all references" don't work.

This is just a simple example; my actual code is a little bit more complex. It doesn't actually include "__ptr64" in the code -- it instead uses a #define (let's call it PTR_SIZE) that resolves to either nothing or "__ptr64" depending on the build type. PTR_SIZE is declared in my project files, but I use the stdafx.h trick to define PTR_SIZE to nothing. That normally fixes problems I have with similar conditional #defines, but it doesn't help here. In case it isn't clear, the code with macros would be:

typedef struct {
    int (* PTR_SIZE functionPointer);
    int * PTR_SIZE plainOldPointer;
    int justAnInteger;
} Structure;

void junk(Structure *x)
{
    printf("%d %d %d\\n", (*x->functionPointer), x->plainOldPointer, x->justAnInteger);
}

The results are identical, except that "PTR_SIZE" is displayed as a known identifier.

I don't really care about the raw "__ptr64" usage; all I need is to get this to work in the #define case. Overriding something in stdafx.h is perfectly acceptable. My code base is unusual enough that I already have 10-15 entries there, and updates have been frequent enough that I wrote a script to automatically merge my stdafx.h entries with the ones from the VAX distribution.

khb
Tomato Guru

Germany
337 Posts

Posted - Jan 28 2009 :  1:03:58 PM  Show Profile  Reply with Quote
I would try installing build 1715 because its description states:
  • C++ keywords __ptr32, __ptr64, __sptr, __uptr, _w64, and __w64 are recognized. (case=7571)
Regards
Marcus
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Jan 28 2009 :  1:33:56 PM  Show Profile  Reply with Quote
Actually, this is a problem due to parsing of function pointers. case=5433
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