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
 1538: namespace, using and scope
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

d_p_robinson
Junior Member

United Kingdom
21 Posts

Posted - Oct 09 2006 :  09:19:44 AM  Show Profile  Reply with Quote
VAX in VC6 appears to have a problem with namespaces where the namespace is referenced by a using statement rather than having the namespace applied as part of the class member function name.
E.g header (Namespaced.h):

namespace SomeNamespace
{
class Namespaced
{
public:
Namespaced();
virtual ~Namespaced();
void method ();
void methodA ();
};
}

Source (Namespaced.cpp):
#include "Namespaced.h"

using namespace SomeNamespace;

Namespaced::Namespaced() {}
Namespaced::~Namespaced() {}
void SomeNamespace::Namespaced::method(){}
void Namespaced::methodA(){}

Test code:
#include "Namespaced.h"

using namespace SomeNamespace;

int main(int argc, char* argv[])
{
Namespaced b;

b.method();
b.methodA();

SomeNamespace::Namespaced c;
c.methodA();

return 0;
}


In test code ALT-G on 'method' presents both header and cpp as alternatives, but ALT-G on 'methodA' goes straight to the header and will not pick up the cpp.

FSIW lists methodA as two separate list items, with and without the namespace.

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 09 2006 :  1:01:15 PM  Show Profile  Reply with Quote
I am seeing the same thing. Thank you for the clear example.

case=971

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

hwatson
Junior Member

23 Posts

Posted - Oct 10 2006 :  12:57:07 PM  Show Profile  Reply with Quote
Aha! This appears to be why I've been having problems with Alt-G for so long. I am seeing the same results in my solution. Adding the namespace to the definition has fixed Alt-G in every case I've tried so far.

I'm using VC++ .NET 2003, so this is not limited to VC6.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 10 2006 :  3:36:21 PM  Show Profile  Reply with Quote
for new code if you use the VA refactoring "Create Implementation" this will place the namespace at the front of the member function when it inserts it into the cpp file for you.

not a complete solution, but this should help a bit

zen is the art of being at one with the two'ness
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