Microsoft & .NETVisual C#Visual C++ 2005 IDE Enhancements

Visual C++ 2005 IDE Enhancements content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

With all the changes to the C++ language, improvements in the IDE have not been given a great deal of attention. Despite the lack of publicity, the IDE improvements are quite significant. They will drastically improve the developer experience on a day-to-day basis. The number of improvements is large and broad—everything from enhancements to the Server Explorer through to IntelliSense support for macros, and UML-like Class Diagrams through to support for the new MSBuild build system. This article and future installments will cover all of these exciting new features.

IntelliSense Improvements

When IntelliSense was introduced in Visual C++ in the mid-1990s, it was quite slow and didn’t offer much help with the potentially complex exercise of C++ coding. When compared to C++, classic Visual Basic code was ridiculously simple, and implementing and using IntelliSense in VB was a straightforward proposition. C++, on the other hand, had many language features that made IntelliSense a hard feature to get right, such as:

  • Namespaces
  • Templates
  • Macros and other pre-processor tricks
  • Include files
  • The separation of code between header and source files
  • A complex compilation process, which makes background compilation quite difficult

All these issues explain why the Visual C++ IDE team has needed a number of versions to get IntelliSense to a state where it is an indispensable developer aid. In the 2005 release of Visual C++, the team is getting very close to achieving this goal. One of the main enhancements is that code is parsed between compilations to allow IntelliSense to give accurate information on the methods and fields available for a particular class. This is still just a best-effort attempt, and complex code statements can still confuse IntelliSense.

As mentioned in the introduction, IntelliSense has been enhanced to support macros. While this isn’t a profound improvement, it can be quite handy, particularly for macros that take a large parameter list. Figure 1 shows IntelliSense providing some help with the venerable MAX macro.

Figure 1. IntelliSense Macro Support

In addition to the macro support, IntelliSense also works better with templates, and the clutter that often diminished the usefulness of the List Members IntelliSense functionality has been remedied by restricting the information that is presented to the included header files.

XML Comments

For developers with C# experience (or even those familiar with Visual Basic.NET 2005), XML comments are a welcome addition to C++. The comments work with both native and .NET projects, and they produce an XML document that can be consumed by Visual Studio.NET and any other third-party documentation production tool like NDoc.

The following table presents the recommended tags for use with XML documentation:

<c> Denotes inline code, like a method or class name
<code> Similar to <c>, but denotes multi-line code
<example> Indicates that the comment is an example of how to use a method or class; will typically include <c> or <code> child elements
<exception>* Specifies an exception that a method can throw
<include>* Allows comments to be bought in from other files; requires a file name and XPath expression
<list> and <listheader> Used to define tables
<para> Denotes a paragraph
<param>* Used to name and describe a parameter that is accepted by the method
<paramref>* Indicates that a term is a parameter accepted by the method.
<permission>* Indicates a permission required to call the method.
<remarks> Provides more in-depth information than the <summary> element
<returns> Describes the methods return value
<see>* Specifies a link
<seealso>* Adds a link that contains additional information to that provided using other tags
<summary> Used to provide the main documentation for a class or method
<value> Describes a property or property accessor

The tags that are marked with asterisks can be optionally validated by the compiler.

XML comments are added above the code element they refer to, and are marked using a triple forward slash. The following code sample shows a simple class that is documented with a summary tag and contains a property documented by a value tag:

///<summary>Demonstrates the use of XML comments in C++</summary>
ref class CommentedClass {
   /// <value>C++/CLI with an automatically-generated backing member
   ///        variable</value>
   property int Prop;


To turn XML documentation production on, set the Generate XML Documentation File property on the Configuration Properties | C/ C++ | Output File page to Yes, or use the /doc switch with the command line compiler (see Figure 2).

Figure 2. Producing an XML Documentation File

With /doc on, a *.XDC file will be produced for every *.CPP file in the project. This file will contain the XML comments for each class in the file. For the code sample shown previously, the XDC file would be:

<?xml version="1.0"?>
   <member name="T:CommentedClass" decl="false"
           source="z:nickdotnet articlesvc++ 2005
           idexmlcommentsxmlcommentsxmlcomments.cpp" line="14">
    <summary>Demonstrates the use of XML comments in C++</summary>
   <member name="P:CommentedClass.Prop" decl="false"
           source="z:nickdotnet articlesvc++ 2005
           idexmlcommentsxmlcommentsxmlcomments.cpp" line="17">
    <value>A C++/CLI with an automatically-generated backing
           member variable</value>

The XDC files are merged together at the end of the compilation process, and an XML file that contains the contents from all the XDC files is produced. The default project template gives the XML file the same name as the generated executable or assembly file. Using this file naming convention allows Visual Studio to use the XML Documentation comments to augment IntelliSense, as shown in Figure 3.

Figure 3. XML Documentation Comments in Use with IntelliSense

Call Browser

Keeping track of which methods a particular method is calling and which methods are calling it can be a tedious process without IDE assistance. While previous versions of the Visual C++ IDE offered features that helped with this task, these features were often inconvenient and not always accurate. The Call Browser in Visual C++ 2005 allows bi-directional navigation of call graphs, and it also allows logical calls to be traced to the location within a source code file where the method is called or implemented.

Figure 4 shows the call graph for the ThreadPool batched execution example program my previous article showed. The Call Browser tree is reasonably complex for a simple program, and for a real-world application, the tree would be quite large. The ability to collapse, expand, and drill-down into a specific call branch can be incredibly useful and is much richer as a navigation mechanism than using the Find In Files dialog.

Figure 4. Call Browser

The Call Bowser has the ability to filter based on user-specified search criteria. Specific function names can be searched for, or the * or ? wild-card search operators can be used.

Next month, I’ll continue the journey through the IDE improvements, including the new Class Diagram tool that allows trip-less, UML-like modeling directly within the IDE.

About the Author

Nick Wienholt is an independent Windows and .NET consultant based in Sydney, Australia. He is the author of Maximizing .NET Performance from Apress, and specializes in system-level software architecture and development with a particular focus on performance, security, interoperability, and debugging. Nick can be reached at

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories