It is for producing documentation from the source files. The /doc
compiler option will cause it to generate an .xdc file which can be turned into an .xml documentation file. VC++ is not as nice about Intellisense as C# is.
References:
Question
In C#, I comment methods like this:
/// <summary>
/// Does absolutely nothing
/// </summary>
/// <param name="a">First useless parameter</param>
/// <param name="b">Second useless parameter</param>
/// <returns>zero</returns>
public int Foo(int a, int b)
{
return 0;
}
Which gives very nice IntelliSense hint window:
What, if any, is the equivalent in Visual C++ or (even better) a solution that would work in other IDEs like XCode or Eclipse?
Update
I found this similar question, but @edtheprogrammerguy's answer has good references so I'll leave the questino here here. Also, SO won't let me delete my question.
Update the Second
A lot of the C# XML comments (<summary>
, for instance) work out of the box. It'd be nice if the ///
comment automatically inserted the required summary
, param
and returns
tags, but I imagine that it'd be pretty easy to implement with a new code snippet.
Update the third
Here's a code snippet that inserts the header. It doesn't scan the method parameter list, but it's a nice start. Save to Documents\Visual Studio 2012\Code Snippets\Visual C++\My Code Snippets
as anything with a .snippet
extension, restart VS, and activate by typing summ
+ TAB above a method.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>SnippetFile1</Title>
<Author>dlively</Author>
<Description>Insert a summary/param/return header for a method</Description>
<HelpUrl>
</HelpUrl>
<Shortcut>summ</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>summary_text</ID>
<ToolTip>summary_text</ToolTip>
<Default>Insert description of method</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>returns_text</ID>
<ToolTip>returns_text</ToolTip>
<Default>Description of return value</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>parameter_name</ID>
<ToolTip>parameter_name</ToolTip>
<Default>Name of the parameter</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>parameter_description</ID>
<ToolTip>parameter_description</ToolTip>
<Default>Description</Default>
<Function>
</Function>
</Literal>
</Declarations>
<Code Language="cpp" Kind="method decl"><![CDATA[/// <summary>
/// $summary_text$
/// </summary>
/// <param name="$parameter_name$">$parameter_description$</param>
/// <returns>$returns_text$</returns>]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Also, see the very nice Code Snippet Designer VS extension which makes creating these a breeze.
Solution 2
It is for producing documentation from the source files. The /doc
compiler option will cause it to generate an .xdc file which can be turned into an .xml documentation file. VC++ is not as nice about Intellisense as C# is.
References:
OTHER TIPS
Regarding automatically inserting comment tags by typing ///, I wrote an extension - CppTripleSlash that you might find useful.