tags:

views:

117

answers:

2

I need comment my function prototype (written in C/C++) with summary, returns, param tags. How can I persuade Visual Studio to insert xml tags after three forward slashes like in C#? I found one solution. When I rename xx.h xx.cs in C++ project, I can use /// for generating xml comments (IntelliSense in xml comments works too). There must be a better way, mustn’t there? It would kill me to write it manually. I’ll grateful for every useful comment.

/// <summary>
/// 
/// </summary>
/// <param name="aa"></param>
/// <returns></returns>
bool function1(TypeX aa);
A: 

Have you taken a look at the /DOC switch - Process Documentation Comments? It generates (encoded) XML documentation to an output file (.xdc) that you can use. Also, see Recommended Tags for Documentation Comments (Visual C++) for the specific tags. Then you can use xdcmake.exe to process the .xdc files into an .xml file, which you can format as you wish.

This option is difficult to find, because it is listed under Language Features for Targeting the CLR, even though use of the CLR is completely optional for using the Process Documentation Comments.

This is not exactly like the C# XML documentation in that it does not present you with code help pop-ups, but this is what is offered via Visual C++ to ease the creation of code documentation using inline comments.

Michael Goldshteyn
He's not referring to compilation of the XML docs, he's referring to the editor's code completion features. Your last paragraph talking about "that's not available" is exactly what the OP is trying to achieve.
Billy ONeal
As I stated in my last paragraph, this is the only feature available for C++. I offered it not as a solution, but as I mentioned in that paragraph, more of a compromise given what is available.
Michael Goldshteyn
I need just write xml comments in Visual Studio C++ just as easily as in C#, that’s all.
+2  A: 

This functionality isn't buit-in. You can try using Visual Studio add-ins. I haven't used Atomineer Utils Pro Documentation myself, but it looks promising. It generates documentation comments and supports C++. It costs $10 though.

Athari