Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Same class names in different projects

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
Alek86 Posted - Jul 07 2017 : 10:58:09 AM
Hi,

For example:
In a solution there are 2 exe projects.
Each project has a class named UserData.
They both have member functions called toString().

If I use GoTo on a call of toString() in one project I sometimes go to the implementation of the other project`s UserData::toString().

It behaves similarly to ODR violation in C++, but both projects are independent EXEs.

Could you update the GoTo algorithm so it goes to the implementation in the same project?
11   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jul 12 2017 : 11:48:05 AM
I have the solution and settings, many thanks for this. So far though I cannot reproduce this problem at all. I have replied via email.
Alek86 Posted - Jul 11 2017 : 4:48:36 PM
From the email - Case 109638
Alek86 Posted - Jul 11 2017 : 4:45:19 PM
Done. I didn't receive any request ID, so please just check one of latest requests (submitted 30 seconds ago)
feline Posted - Jul 10 2017 : 4:21:09 PM
You have tried these simple steps on your system, and you are seeing the problem?

Which IDE and version of VA are you using?

I have tried this with VS2015 and VA 2223, and I am not seeing any problems. I am always taken directly to the function declaration in the current file, and the current project. Since the steps are simple, and the code is clear, I don't think I have done this any differently than you.

Can you send me a copy of your test solution, along with your VA and IDE settings please, I can then try the same solution and the same settings here, and see if I can reproduce this alt-g problem.

Settings can be exported via:

VA Options -> Performance -> Export Settings
IDE tools menu -> Import and Export Settings -> Export selected environment settings

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.
Alek86 Posted - Jul 10 2017 : 11:22:31 AM
Do you want me to create a separate thread with these reproduction steps? This thread's name looks wrong now.
Alek86 Posted - Jul 07 2017 : 4:27:58 PM
Seems like I oversimplified the case. In real projects it involved templates :)



A close approximation. To reproduce similar behavior:
1) Create a solution with 2 empty projects.
2) Create a main.cpp in each project.
3) In each main.cpp put

class Class
{
public:
void func() const {}
};

template <typename T>
struct CT1
{
T t;
};
struct CT2 : CT1<Class>
{
CT2() { t.func(); }
};

int main()
{
Class c;
c.func();
}

4) Try Alt+G on c.func(). In my simple solution it proposes go to func in both projects. In my real solution it only proposes to go to the first project with the same class/function.
feline Posted - Jul 07 2017 : 3:27:41 PM
How often does this go wrong for you? All the time? 1 in 10? 1 in 500?

I have set up a simple test case here, based on your description, and so far, I am always taken to the version of the class in the current project. I am getting the Alt-g menu every time I trigger alt-g on the "toString()" function call, which lists the declaration and implementation, and the correct case of the file names for the current project.

I have tried alt-g in both projects several times now, and I am always being taken to the correct file. But if this is more random for you, then I may not have tested enough times.
Alek86 Posted - Jul 07 2017 : 2:55:02 PM
1) Both classes are in the global namespace
2) I`m pressing Alt+G on the function call, so the dialog is shown with .cpp and .h (declaration and definition), but it shows the different project function.
3) Yes, I have shared files, but the classes are not there.

What might affect this behavior: the .h files for these classes are named same if you ignore case: connection.h and Connection.h.
The files are in different folders though.
feline Posted - Jul 07 2017 : 2:34:45 PM
Oh, that I did not expect.

Are you using namespaces for one or both classes? Or are both classes in the global namespace?

Are you being taken directly to the "ToString()" member in the wrong class, or are you getting an Alt-g menu, which happens when there is more than one possible destination, and VA is not sure which one to jump to?

Do you know if any of your code files are shared across more than one project? You can easily add the same code file to several projects if you choose to, so I am just wondering if this might be a factor here.
Alek86 Posted - Jul 07 2017 : 12:14:51 PM
I have this setting ON
feline Posted - Jul 07 2017 : 11:35:20 AM
If you turn On the setting:

VA Options -> Projects and Files -> Restrict Goto (Alt+G) to active project

does this have any effect?

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