Generating documentation with Doxygen

A few days ago, I had my first experience with Doxygen, an open-source documentation generator similar to Javadoc.

After a few hours of documenting my code to a satisfactory level, I had a very professional-looking set of HTML documentation. At work the next day, I used Doxygen to generate code for a Visual C# class library, which had been documented with XML comments.

Doxygen supports most C-derived programming languages including C, C++, Java and C#. It also allows you to define custom pages and sections; you are not limited to code documentation.

Documenting a method is very simple:

/// @brief Calculate the sum of two values.
///
/// Adds the two values together and returns their sum.
///
/// @param[in] aa The first value.
/// @param[in] bb The second value.
///
/// @return The sum of both values.
///
/// @note This method is deprecated!
///
/// @see operator+()
int add(int aa, int bb);

A full list of Doxygen commands is available here.