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
 1422: Poor handing of unnamed namespaces in C++
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

weshunt
Junior Member

USA
23 Posts

Posted - Sep 13 2005 :  2:50:05 PM  Show Profile
Using the following simple app (at bottom), it seems that VAX is not handling private namspaces properly (1418 and before worked fine). In my real apps, it appears that all functions in private namespaces are not being parsed properly, and all get squiggly red lines under them.

-Wes

-- main.cpp --

namespace {
  void PrivateMethod(int parm0, float parm1, bool parm3) {}
}
int main() {
  // neither way of specifying the symbol works
  // PrivateMethod(0, 1, true);
  // ::PrivateMethod(0, 1, true);
  return 0;
}


My data:
VA_X.dll file version 10.1.1422.0 built 2005.09.09
VAOpsWin.dll version 1.3.2.5
am files\\visual assist x\\\\VATE.dll version 1.0.4.2
DevEnv.exe version 7.10.3077.0
msenv.dll version 2.0.1881.0
Font: Courier New 13(Pixels)
Comctl32.dll version 6.0.2900.2180
WindowsNT 5.1 Build 2600 Service Pack 2
2 processors

Platform: Custom
Stable Includes:
C:\\develop\\UnCommon\\code;
C:\\develop\\library\\Xenon\\inc\\xbox;
C:\\develop\\library\\DIRECTX9\\inc;
C:\\develop\\library\\BINK;
C:\\develop\\library\\HAVOK3;
C:\\develop\\library\\Magma;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\include;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\include;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\PlatformSDK\\include\\prerelease;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\PlatformSDK\\include;

Library Includes:
C:\\develop\\UnCommon\\code;
C:\\Program Files\\Microsoft Xbox 360 SDK\\Source\\crt;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\src\\mfc;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\src\\atl;
C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\crt\\src;

Other Includes:



feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Sep 13 2005 :  6:18:11 PM  Show Profile
a C++ question first, how come this works? my understanding is that the function main is not inside the unnamed namespace, so the function PrivateMethod() is out of scope.

you cannot use a using statement to include the namespace, since it has no name, and putting :: at the front specifies global scope, not an unnamed namespace.

obviously there is something i am missing, since i have just placed the following code into a C++ project using VS 2003 and VA 1422


namespace {
    void PrivateMethod(int parm0, float parm1, bool parm3) {}
}

int testScope() {
    PrivateMethod(0, 1, true);
    ::PrivateMethod(0, 1, true);
    return 0;
}


VA's view is attached, and the code compiles without any warnings or errors.


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

weshunt
Junior Member

USA
23 Posts

Posted - Sep 13 2005 :  7:34:43 PM  Show Profile
quote:
Originally posted by feline

a C++ question first, how come this works?



unnamed namepaces are the "C++ way" to declare variables/functions without external linkage. It is essentially identical to a static var. See the MSDN docs or any other C++ reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_pluslang_unnamed_namespaces.asp.

So yes, my examples are valid C++ code, and we do things like it EVERYWHERE in our code. Please note that VAX <= 1418 parsed all this correctly.

-Wes

Edited by - weshunt on Sep 13 2005 7:35:39 PM
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Sep 14 2005 :  12:35:27 AM  Show Profile
Will be fixed in 1423.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000