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
 1609: Identical namespaces
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Frunobulax
Ketchup Master

84 Posts

Posted - Oct 22 2007 :  1:04:15 PM  Show Profile  Reply with Quote
Hi,

I'm having trouble with identically named classes in two namespaces. In the main() call below, VAX suggests (only) doSomething() instead of doSomethingElse() and getClass().

Regards, Thomas

#include "stdafx.h"
#include <boost/shared_ptr.hpp>

namespace foo {
class _MyClass {
public:
void doSomething() {}
};
typedef boost::shared_ptr<_MyClass> MyClass;
}

namespace bar {
class _MyClass {
public:
void doSomethingElse() {}
foo::MyClass getClass();
};
typedef boost::shared_ptr<_MyClass> MyClass;
}

int _tmain(int argc, _TCHAR* argv[])
{
bar::MyClass lClass(new bar::_MyClass);

lClass->doSomethingElse();

return 0;
}


"The nice part about being a pessimist
is that you are constantly being either
proven right or pleasantly surprised."
(George F. Will)

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Oct 22 2007 :  1:26:28 PM  Show Profile  Reply with Quote
Can you try compiling the project, and see if this makes any difference.

I added this code to my test project, renamed "_tmain" since I don't want duplicate main functions, compiled the project to make sure the code is valid, and I am seeing no problems at all.

When I first copy / pasted the code into the file "doSomethingElse" was underlined as a mistyped symbol, which I suspect was because VA had not parsed boost/shared_ptr.hpp at that point in time.

zen is the art of being at one with the two'ness
Go to Top of Page

Frunobulax
Ketchup Master

84 Posts

Posted - Oct 23 2007 :  05:53:01 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

Can you try compiling the project, and see if this makes any difference.



Sure, I did compile the project and it didn't make any difference :-\\

quote:

I added this code to my test project, renamed "_tmain" since I don't want duplicate main functions, compiled the project to make sure the code is valid, and I am seeing no problems at all.

When I first copy / pasted the code into the file "doSomethingElse" was underlined as a mistyped symbol, which I suspect was because VA had not parsed boost/shared_ptr.hpp at that point in time.



If I place the caret on the #include, then VAX does show me the correct location of the header.

The problem went away after clearing the cache, reparsing (and restarting VS). However, I do see the same problem in real-life projects, so it appears that there is some caching problem. (Which is probably bad news because such problems are difficult to reproduce.)

Regards, Thomas

"The nice part about being a pessimist
is that you are constantly being either
proven right or pleasantly surprised."
(George F. Will)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Oct 23 2007 :  09:22:35 AM  Show Profile  Reply with Quote
This is starting to remind me of this thread: http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=6750

It is not the same problem, but in that thread there was a similar feature, that once VA had seen a certain piece of confusing code the symbol database had to be rebuilt to fix the problem.

Of course that does not help much, or get us very far.

Is the problem happening again at the moment? If so can you copy / paste the following test code into a file please, and see what happens:

namespace SPACE_FELINE_CHOCOLATE {
	class CFelineDuplicate {
	public:
		void updateChocolateOrange() {}
	};
}

namespace SPACE_FELINE_ORANGE {
	class CFelineDuplicate {
	public:
		void updateSquareBanana() {}
	};
}

static void testCallingFelineDuplicateClass()
{
	SPACE_FELINE_ORANGE::CFelineDuplicate localFeline;
	localFeline|;
};


I want to get away from boost, typedef's, and any "common" class and namespace names. The names I have used here are unlikely to turn up in your project, and there is nothing "clever" here, no templates, nothing to confuse the issue. So VA should have no problems at all with this code, even if something is a bit confused.

zen is the art of being at one with the two'ness
Go to Top of Page

Frunobulax
Ketchup Master

84 Posts

Posted - Oct 26 2007 :  03:48:42 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

[...]Is the problem happening again at the moment? If so can you copy / paste the following test code into a file please, and see what happens:

[...]

I want to get away from boost, typedef's, and any "common" class and namespace names. The names I have used here are unlikely to turn up in your project, and there is nothing "clever" here, no templates, nothing to confuse the issue. So VA should have no problems at all with this code, even if something is a bit confused.



Yes, the problem does happen again. I did try your code and everything is fine though.

I'm afraid I don't have a lot of time to experiment on this at the moment, but it seems to me that I neglected to mention a relevant fact: I do have several Visual Studios open occasionally, working on almost identically code on different branches. I closed all Visual Studios and opened just the test project, and VAX did give the correct suggestions. Previously I kept another (unrelated) instance of VS open and closing and reopening the test project didn't help.

So is it possible that, say, the existence of severall boost include trees does confuse VAX?

Regards, Thomas

"The nice part about being a pessimist
is that you are constantly being either
proven right or pleasantly surprised."
(George F. Will)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Oct 26 2007 :  08:26:59 AM  Show Profile  Reply with Quote
We have had problems before where two IDE's, on similar solutions, confuse VA. These problems were supposed to have been fixed several builds ago, but it is certainly possible you have found another problem case.

I am wondering how to try and reproduce the problem here, assuming this is the trigger.

You mention several boost include tree's, do you have several copies of the boost library, one per branch, or only one copy of boost?

How many IDE's do you open at once? Just two? Three? Four? I am wondering how many branches are involved here.

When you opened the test project and got the correct suggestions, does this test project use the "unique" code I posted, or code that used to fail? Did you have to rebuild VA's symbol databases to get this working, or was closing all the IDE's and reloading them enough?

Do you have:

VA Options -> Performance -> Parse all files when opening a project

turned on or off?

zen is the art of being at one with the two'ness
Go to Top of Page

Frunobulax
Ketchup Master

84 Posts

Posted - Oct 26 2007 :  11:09:56 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

[...]You mention several boost include tree's, do you have several copies of the boost library, one per branch, or only one copy of boost?


Several, one per branch. All identical at boost 1.34 though (at the moment).

quote:

How many IDE's do you open at once? Just two? Three? Four? I am wondering how many branches are involved here.


On a regular basis - one or two, occasionally three. I'm not _that_ good at multitasking :-)
Currently only two working branches, so the rare three studios case is that I'm working on different projects in one tree (which will use the same libraries).

quote:

When you opened the test project and got the correct suggestions, does this test project use the "unique" code I posted, or code that used to fail? Did you have to rebuild VA's symbol databases to get this working, or was closing all the IDE's and reloading them enough?



As I said, I didn't check extensively. I checked out the test project, it gave the wrong suggestion, pasted your sample code, got the correct suggestions for that. Then I closed all VS instances, reopened the test project, and got the right suggestions in my code too (that previously gave the wrong suggestion).

quote:

Do you have:

VA Options -> Performance -> Parse all files when opening a project
turned on or off?



I don't think I changed that one - it's checked at the moment.

Regards, Thomas

"The nice part about being a pessimist
is that you are constantly being either
proven right or pleasantly surprised."
(George F. Will)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Oct 26 2007 :  12:50:45 PM  Show Profile  Reply with Quote
Sounds fairly straight forward so far.

Boost, is this included in the solution, or the correct copy of boost simply referenced via:

Project properties -> C/C++ -> General -> Additional Include Directories

zen is the art of being at one with the two'ness
Go to Top of Page

Frunobulax
Ketchup Master

84 Posts

Posted - Nov 07 2007 :  10:42:13 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

Sounds fairly straight forward so far.

Boost, is this included in the solution, or the correct copy of boost simply referenced via:

Project properties -> C/C++ -> General -> Additional Include Directories



Sorry, didn't reply to this. The boost is included via "additional include directories" in the solution and not as static include in VAX.

I had another weirdness today:
When hitting Alt-G on a symbol, VAX offered me to jump to two locations - the same include in different branches. So there is a problem with cross-branch including.

As I mentioned before, the somewhat weird thing is that we copy all custom libraries in an install directory which is added to the path, so headers from these libraries are included as #include <MyHeader> and not as #include "MyHeader".

Maybe VAX does assume somehow that #include <MyHeader> has to be a static include?

Regards, Thomas

"The nice part about being a pessimist
is that you are constantly being either
proven right or pleasantly surprised."
(George F. Will)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Nov 09 2007 :  7:15:01 PM  Show Profile  Reply with Quote
I have reproduced something, perhaps the problem you are seeing. I now need to try and pin down what is going on here, and see if I can produce steps to reproduce it again.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Nov 12 2007 :  07:14:52 AM  Show Profile  Reply with Quote
I have something, I am just not sure what to make of it. For me I only need a single IDE, and a "simple" test project. The trigger is restarting the IDE. If I copy / paste your original sample code into the IDE then VA normally understands it quite happily. Restart the IDE and suddenly VA does not understand the code.

Once this has happened nothing I try gets VA to start understanding the code again.

case=9859

zen is the art of being at one with the two'ness
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Sep 13 2008 :  01:10:58 AM  Show Profile  Reply with Quote
case=9859 is fixed in build 1649
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