Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Move Method implimentations bug

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
Breany Posted - Jul 18 2017 : 12:41:50 AM
This applies a lot to Qt code (Which requires QOBJECT define at the beginning of each Qt class), but here's an independent example:
I craft this test code -


#define STUBBYS TestClass() {}  virtual ~TestClass() {}

class TestClass
{
public:
  STUBBYS;
  int TestFunc() { return 1; }
};


Right-click the class and select "Move method implementations to source file", and strangely 3 functions show up in the list, not one. For grins, just hit okay moving all functions, and this results:
(Header file)


#define STUBBYS TestClass() {}  virtual ~TestClass() {}

class TestClass
{
public:
  STUBBYS;
  int TestFunc();
};

(Source file)

int TestClass::TestFunc()
{
  return 1;
}

TestClass::TestClass()
{

}

TestClass::~TestClass()
{

}


Obviously, it should not (and does not have the ability to) move the definitions out of the #define, but it should also not generate duplicate definitions!

I know this example is ... Rather bad code... But it shows the problem.

VA_X.dll file version 10.9.2223.0 built 2017.06.22
DevEnv.exe version 14.0.25420.1 Professional
msenv.dll version 14.0.25425.1
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jul 18 2017 : 07:32:51 AM
Currently what VA is doing is generally "correct". It's surprisingly common to come across cases where parts of a class are defined by a macro somewhat like this.

To change how VA handles this macro, either STUBBYS or Q_OBJECT, depending on your situation, create a new text file called "va_stdafx.h" and place it in the same directory as your SLN or VCXPROJ file. Open the file in a text editor, and add the line or lines:

#define STUBBYS
#define Q_OBJECT

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

VA Options -> Performance -> Rebuild symbol databases

and restart your IDE. There is no need to add this file to the solution, VA looks specifically for this file, which is used to help our parser, or to tell it to handle things in a specific manor.

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