BUG: ClassView Lacks "Go to Declaration" for Static Data Members

Last reviewed: January 8, 1998
Article ID: Q179012
The information in this article applies to:
  • The ClassWizard included with:

        - Microsoft Visual C++, 32-bit Editions, version 5.0
    

SYMPTOMS

ClassView's context menu offers both "Go to Declaration" and "Go to Definition" options for class member functions. However, class data members with the "static" attribute have only the "Go to Definition" option.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Consider the following class, presented for illustration only:

   // Class Definition
   class MyClass
   {
   public:
      // Data members
      static int  i;
      char        c;

      // Function members
      MyClass();
   };

   // Class Declarations
   int MyClass::i = 0;
   MyClass::MyClass()
   {
      c = 0;
   }

Each instance of "MyClass" contains the normal data member "c". Such members are normally initialized in the class's constructor. In Visual C++'s ClassView pane, the menu resulting from right-clicking on MyClass member "c" correctly indicates that it has no implementation (or declaration). However, a static data member, such as "i" in the example, requires an explicit declaration outside of the class definition. ClassView does not offer an option for jumping directly to such a declaration.

Steps to Reproduce Behavior

  1. Create a class with a static data member as in the example above.

  2. Save the file.

  3. Expand the class in VC++'s ClassView pane.

  4. Right-click on the static member; there is no "Go to Declaration" option.

Workaround

The following is a suggested workaround:

  1. In the ClassView pane, right-click on the member variable.

  2. Select "References."

  3. Rebuild with browse information if prompted to do so.

  4. From the "Definitions" list, jump to either the declaration (.h file) or definition (.cpp file).

REFERENCES

"Language Quick Reference – static," VC++ 5.0 online books.

Keywords          : kbcode
Version           : WINNT:5.0
Platform          : winnt
Issue type        : kbbug


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 8, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.