C++ namespace's and the Dev. Studio Browser
Randy Sales -- rsc@halcyon.com Tuesday, October 15, 1996 Environment: VC 4.1, NT 3.51 I am attempting to use namespace's with reasonable results but I'm a little discouraged to find that the Dev. Studio browser seems to have no knowledge of defined namespace's and is unable to accurately determine the correct definition of a variable defined in two separate namespace declarations. Is there something additional required to make the browser namespace aware. Randy Sales -- RS Consulting 1521 1/2 Cedar Street Everett, WA 98201 Phone 206-259-1056 Fax 206-259-1315 email rsc@halcyon.com
Bauer@lai.unisinos.tche.br Thursday, October 17, 1996 According to the Microsoft Knowledge Base article Q140439, Visual C++ 4.1 doesn't show classes defined inside a namespace and this is a bug. I believe the problem extends to the variable definitions. Best regards, Carlos Henrique Bauer Universidade do Vale do Rio dos Sinos - UNISINOS Nucleo de Pesquisa e Apoio `a Industria - NAI Laboratorio de Automacao Industrial - LAI ------------------------------------------------ http://lai.unisinos.tche.br Av. Unisinos, 950 Phone: 55515903333 93022-000 Sao Leopoldo RS FAX: 55515921035 Brazil >---------- >From: Randy Sales[SMTP:rsc@halcyon.com] >Sent: Terca-feira, 15 de Outubro de 1996 14:03 >To: mfc-l@netcom.com >Subject: C++ namespace's and the Dev. Studio Browser > >Environment: VC 4.1, NT 3.51 > >I am attempting to use namespace's with reasonable results >but I'm a little discouraged to find that the Dev. Studio >browser seems to have no knowledge of defined namespace's >and is unable to accurately determine the correct definition >of a variable defined in two separate namespace declarations. >Is there something additional required to make the >browser namespace aware. > >Randy Sales > >-- >RS Consulting >1521 1/2 Cedar Street >Everett, WA 98201 > >Phone 206-259-1056 >Fax 206-259-1315 >email rsc@halcyon.com >
Randy Sales -- rsc@halcyon.com Friday, October 18, 1996 Carlos, Thanks for the feedback, I should have mentioned that I had read KB Q140439 in my original question. But I don't think this is related. Fact is, I can ask the browser for the Definitions and References of a variable defined in a namespace and it will open the dialog and show me all the defs and refs. But if I place the caret in a multiply defined namespace variable and press F11 (defined as BrowseGoToDefinition) I should be given the opportunity to resolve the ambiguity of mutliple definitions before being taken to the definition of the variable. Instead, I am immediately taken to one of the several definitions with no indication that there are others. This could be very misleading to someone later needing to maintain this source code. Hope this clarification helps. Thanks, Randy Sales Bauer@lai.unisinos.tche.br wrote: > > According to the Microsoft Knowledge Base article Q140439, Visual C++ > 4.1 doesn't show classes defined inside a namespace and this is a bug. I > believe the problem extends to the variable definitions. > > Best regards, > > Carlos Henrique Bauer > > Universidade do Vale do Rio dos Sinos - UNISINOS > Nucleo de Pesquisa e Apoio `a Industria - NAI > Laboratorio de Automacao Industrial - LAI > ------------------------------------------------ > http://lai.unisinos.tche.br > Av. Unisinos, 950 Phone: 55515903333 > 93022-000 Sao Leopoldo RS FAX: 55515921035 > Brazil > > >---------- > >From: Randy Sales[SMTP:rsc@halcyon.com] > >Sent: Terca-feira, 15 de Outubro de 1996 14:03 > >To: mfc-l@netcom.com > >Subject: C++ namespace's and the Dev. Studio Browser > > > >Environment: VC 4.1, NT 3.51 > > > >I am attempting to use namespace's with reasonable results > >but I'm a little discouraged to find that the Dev. Studio > >browser seems to have no knowledge of defined namespace's > >and is unable to accurately determine the correct definition > >of a variable defined in two separate namespace declarations. > >Is there something additional required to make the > >browser namespace aware. > > > >Randy Sales > > > >-- > >RS Consulting > >1521 1/2 Cedar Street > >Everett, WA 98201 > > > >Phone 206-259-1056 > >Fax 206-259-1315 > >email rsc@halcyon.com > > -- RS Consulting 1521 1/2 Cedar Street Everett, WA 98201 Phone 206-259-1056 Fax 206-259-1315 email rsc@halcyon.com
Bauer@lai.unisinos.tche.br Wednesday, October 23, 1996 Randy, I decided to create a small application with AppWizard to make some tests with the Visual C++ browser. The name of the app is NameSpace. At the begining of the file NameSpaceView.cpp was added the following namespace and variable declarations: namespace test { extern int xy; }; extern int xy; As you can see, there are two variables xy declared in two diferent namespaces: one in the test namespace and another in the global namespace. In the CNameSpaceView constructor I added the code just for testing the browser behavior. It seems like this: CNameSpaceView::CNameSpaceView() { test::xy = 0; xy = 0; } Both variables were defined at the end of the file as it follows: namespace test { int xy; }; int xy; After building the project with the `Build Browse Info File' option enabled, I asked the browser, through the F11 key, to show me the definition of the variable test::xy used inside the CNameSpaceView constructor. The cursor jumped to the definition inside test namespace as it was expected. Then I asked the browser to show me the definition of global namespace's xy variable. The cursor jumped to the same place as before, this time, the wrong namespace. Please note that the definition inside namespace test is the definition of xy that appears first in the NameSpaceView File. So, I inverted the position of both definitions of xy, in this way: int xy; namespace test { int xy; }; And then repeated the same tests. In both, the browser shows me the global namespace xy definition, the first definition in the file. It seems to me that the browser is ignoring the namespaces, and jumping to the first definition in the global namespace and at global scope it finds. I interpret the KB Q140439 as a statement of Microsoft that Visual C++ has some intrisec problems dealing with namespaces, no matter if it is in the class view or in the browser. I agree with you that this could be very misleading to someone maintaining the code later, but I'm afraid we have to wait for a fix from Microsoft. Carlos Henrique Bauer Universidade do Vale do Rio dos Sinos - UNISINOS Nucleo de Pesquisa e Apoio `a Industria - NAI Laboratorio de Automacao Industrial - LAI ------------------------------------------------ http://lai.unisinos.tche.br Av. Unisinos, 950 Phone: 55515903333 93022-000 Sao Leopoldo RS FAX: 55515921035 Brazil >---------- >From: Randy Sales[SMTP:rsc@halcyon.com] >Sent: Sexta-feira, 18 de Outubro de 1996 11:58 >To: mfc-l@netcom.com >Subject: Re: C++ namespace's and the Dev. Studio Browser > >Carlos, > >Thanks for the feedback, I should have mentioned >that I had read KB Q140439 in my original question. But >I don't think this is related. Fact is, I can ask the >browser for the Definitions and References of a variable >defined in a namespace and it will open the dialog and >show me all the defs and refs. But if I place the caret >in a multiply defined namespace variable and press F11 >(defined as BrowseGoToDefinition) I should be given the >opportunity to resolve the ambiguity of mutliple definitions >before being taken to the definition of the variable. >Instead, I am immediately taken to one of the several >definitions with no indication that there are others. >This could be very misleading to someone later needing >to maintain this source code. Hope this clarification >helps. > >Thanks, >Randy Sales > >
| Вернуться в корень Архива |