Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Suggestions list confused about current scope

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
TripShock Posted - Jun 24 2013 : 1:26:21 PM
I have some code that uses some wacky macros to declare and define class methods. When I use those macros, I find that VA doesn't seem to "understand" the function scope and suggest names of local and instance variables while typing. I have created a reduced source file that reproduces the issue:

#include <iostream>

using namespace std;

#define CLASS_NAME CMyClass

#define DECLARE_METHOD(_MethodName)                                 \void _MethodName ()

#define DEFINE_METHOD(_Name, _Desc, _Args)                          \    DEFINE_CLASS_METHOD(CLASS_NAME, _Name, _Desc, _Args)            \
#define DEFINE_CLASS_METHOD(_Class, _Name, _Desc, _Args)            \void _Class::_Name ()

class CMyClass
{
public:

    DECLARE_METHOD(MyMethod);

private:

    int m_TheValue;
};

DEFINE_METHOD(
    MyMethod,
    "Test string",
    "Another test string"
    )
{
    auto newValue = 123;
    auto anotherValue = 234;

    //
    // While typing the following line, suggestion list did not show
    // either local variable. Only after hitting Ctrl-Space did it show
    // suggestions correctly.
    //
    newValue += anotherValue; 

    //
    // Same for the following line: m_TheValue was not suggested automatically.
    //
    m_TheValue += 123;

    wcout << L"Called!" << endl;
}

int
wmain ()
{
    CMyClass myClass;

    myClass.MyMethod();

    return 0;
}


If you are curious, I am writing code that uses the EngExtCpp headers. The above macros are simplified versions of macros in that header.
3   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Jun 26 2013 : 5:21:20 PM
Well, that is great news! It should work without step 2 in theory, but it didn't for me. Maybe it was just a "timing" issue, or I missed something.
TripShock Posted - Jun 25 2013 : 1:03:42 PM
Excellent!

Do I need to perform step (2) if I performed step (1)? It would seem (1) alone would fix the issue (and (3) of course), and indeed, it did; I didn't have to perform step (2).
accord Posted - Jun 25 2013 : 12:03:50 PM
It seems that I was able to create a workaround for you, here are the steps:

1. Turn on recursive macro parsing: (use "NoDepthLimit")
http://docs.wholetomato.com?W363

2. Create a VA_Stdafx.h next to your project file with the following content:
#define DEFINE_METHOD(_Name, _Desc, _Args) \ CLASS_NAME::_Name ()

3. Rebuild your symbol databases
VA Options -> Performance -> Rebuild

You may need to modify the replacement macro in step 2, since you posted a simplified sample, but this is the basic idea.

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