Author |
Topic |
|
Rasmuss
Senior Member
33 Posts |
Posted - Apr 07 2008 : 04:31:47 AM
|
Having nested namespaces and 'using namespace' will result in invalid symbols.
Header file:
namespace TestNamespace1
{
namespace TestNamespace2
{
class TestClass
{
TestClass();
void TestFunction();
};
}
}
CPP file:
#include "namespaces.h"
using namespace TestNamespace1;
using namespace TestNamespace2;
TestClass::TestClass() {} // Not working
TestNamespace1::TestNamespace2::TestClass::TestClass() {} // Working
TestNamespace1::TestClass::TestClass() {} // Not working
TestNamespace2::TestClass::TestClass() {} // Working
void TestClass::TestFunction() {} // Not working
Commenting out one of the namespaces in the header file will make the functions with no namespace identifiers work.
Regards, Rasmus
VA_X.dll file version 10.4.1626.1 built 2008.01.17 Licensed to: VA X: ioi.dk (45-user license) Support ends 2009.05.30 DevEnv.exe version 8.0.50727.762 msenv.dll version 8.0.50727.762 Font: Courier New 13(Pixels) Comctl32.dll version 6.0.2900.2982 Windows XP 5.1 Build 2600 Service Pack 2 8 processors
Platform: Win32 Stable Includes: C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include; C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\include; C:\\Program Files\\Microsoft Visual Studio 8\\VC\\PlatformSDK\\include; C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\include;
Other Includes:
Stable Source Directories: C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\mfc; C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\mfcm; C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\atl; C:\\Program Files\\Microsoft Visual Studio 8\\VC\\crt\\src;
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Apr 07 2008 : 3:15:25 PM
|
This is improved in VA 1632, which we have just posted as a new beta build of VA, details here:
http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=7404
For me two of your three not working lines in the cpp file now work. The failing line:
TestNamespace1::TestClass::TestClass() {} // Not working
does not compile, so it is reasonable that VA is underling the class name in this situation. |
zen is the art of being at one with the two'ness |
|
|
Rasmuss
Senior Member
33 Posts |
Posted - Apr 08 2008 : 04:39:46 AM
|
quote: Originally posted by feline
This is improved in VA 1632, which we have just posted as a new beta build of VA, details here:
http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=7404
For me two of your three not working lines in the cpp file now work.
I have just tried out 1632, and unfortunately I do not get the same results as you.
I have rebuilt symbol database, cleared history, cache and temp files, deleted my .ncb file and then restarted Visual Studio. This is my result:
|
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Apr 08 2008 : 09:09:15 AM
|
I have just created a new default C++ console project, and then added your test code to it. You can download the test project from here:
http://forum.wholetomato.com/colin/forumimages/7402_namespace_test.zip
Can you please open this in VS2005 and see what underlining you see? I am seeing the same underlining I reported, only the invalid function is underlined.
If you see the same as me in this test project then something else in your code or project is triggering this problem. We just have to find out what. |
zen is the art of being at one with the two'ness |
|
|
Rasmuss
Senior Member
33 Posts |
Posted - Apr 08 2008 : 09:29:22 AM
|
quote: Originally posted by feline Can you please open this in VS2005 and see what underlining you see? I am seeing the same underlining I reported, only the invalid function is underlined.
I get the same result in your project.
I did notice the following though.
Initially when opening the project I see nothing underlined at all, but if I place the caret over the first function, I see nothing in the "go toolbar", and that goto (alt+g) does nothing.
If I place the caret over the second function, I can see it pointing to the TestClass() in the toolbar, and goto gets me to the header file.
If I manually select to reparse the file, the non valid symbols will be underlined, and match the goto ability.
I have tried to rebuild symbols etc with this project as well. But just restarting and reopening the project will result in nothing underlined before reparsing. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Apr 08 2008 : 1:25:42 PM
|
VA does not underline any mistyped symbols when you first open a file. The underlining is only applied after you have made an edit to the file. This is a performance optimisation, to save underlining code you are just reading and not editing.
This underlining, something odd is going on here. I now have this simultaneously working and failing, at the same time, in the same file. I duplicated the code and renamed one copy. One copy is showing my underlining and the other copy is showing your underlining.
I will put in a bug report when I have found the pattern. |
zen is the art of being at one with the two'ness |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Apr 08 2008 : 2:24:31 PM
|
I simply cannot reproduce this underlining problem with valid (it will compile) code. Can you try this modified simple project please:
http://forum.wholetomato.com/colin/forumimages/7402_namespace_test2.zip
There is an invalid variable, as a comment, on line 18. Uncomment this to trigger underlining, and what happens? For me only this variable name is underlined, there is no other underlining in the file. |
zen is the art of being at one with the two'ness |
|
|
Rasmuss
Senior Member
33 Posts |
Posted - Apr 09 2008 : 04:18:04 AM
|
quote: Originally posted by feline
I simply cannot reproduce this underlining problem with valid (it will compile) code. Can you try this modified simple project please:
http://forum.wholetomato.com/colin/forumimages/7402_namespace_test2.zip
There is an invalid variable, as a comment, on line 18. Uncomment this to trigger underlining, and what happens? For me only this variable name is underlined, there is no other underlining in the file.
I get the same result as you. All of the functions are working.
But. I think I've found what breaks the symbols. It's constructors.
If I add a constructor, and put in the implementation without namespaces, and reopen the project, I get the following:
As you can see, the constructor is colored like a normal function, whereas it should be blue. Furthermore, it also breaks MemberFunction3() which is now an invalid symbol.
If I put in the constructor with namespaces, it is still colored as a normal function, but it is not underlined, and goto will take me to the header file. It also still breaks MemberFunction3():
I am able to provoke VAX into parsing the constructor properly, by commenting out the constructor in the cpp file, saving, going to the header file, and go back to the cpp file and uncomment it.
This results in a proper looking and working file:
|
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Apr 09 2008 : 1:46:44 PM
|
That was it. I am now able to reproduce this on code that compiles:
case=15849 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|