2

I've been following a C++ tutorial, and would like to comment some of the parameters and methods for convenience so that their associated comments are displayed when I hover over them (uses Intellisense I believe). I know how to do this in C#, but haven't been able to figure it out in C++.

In Visual C# 2010 express, I could do the following:

Type "///" and the summary and param tag were automatically created. Filling in the comments I could create:

/// <summary>
/// Constructor.
/// </summary>
/// <param name="value_Initial">Initial value.</param>
public DataObject_Float(float value_Initial){
...
}

such that hovering over them displayed their parameter and method info. The closest I've been able to get is:

// Constructor.
// value_Initial = Initial value

which is not ideal.

How can I do/emulate this behavior in VS Ultimate 2010 in C++, even if I have to manually type out the tags, variable names, etc. I have been unable to figure out/find the syntax for this. The compiler does not use CLR, which apparently isn't supported by Intellisense. I've also installed a trial version of Visual Assist X, if that could be used to help with this. Additionaly, should the comments for the methods and parameters be placed in the header file or the .cpp file?

Caribou
  • 2,070
  • 13
  • 29
user1320150
  • 45
  • 1
  • 3

1 Answers1

1

The syntax for VC++ doc comments is reasonably documented in two places. One is the recommended tags and the other is the delimiters.

The doc comments will not show up in hover text, but they will show up in when the auto-complete list is up (i.e. that will show the symbol declaration, any doc comments, and the symbol the file is declared in.

I believe you want to put the doc comments in the header as it seems to be picked for the current translation unit only (i.e. meaning if it's the .cpp you'll only see it when you are in that single .cpp file).

Josh Heitzman
  • 1,816
  • 1
  • 14
  • 26