namespace foo {
class Class
{
std :: string m_name;
public:
Bool function (const std :: string & s, int n)
{
// The comment summarizes what this section of code is doing
for (int i = 0; i <n; ++ i) {
int total_sum = 0;
// When something fails, return it early
if (! Something ()) returns false;
...
if (SomethingElse (i)) {
total_sum + = ComputeSomething (g_count);
} else {
DoSomething (m_name, total_sum);
}
}
// Success returns usually in the end
back right;
}
}
} // namespace foo
***Comment Doxygen***
To facilitate the creation of documentation, use an iso-compatible comment block for functions, methods, and fields.
For example, to describe the function used:
/ * *
* ... teks ...
* @param [di] arg1 Deskripsi
* @param [di] arg2 Deskripsi argumen lain
* @pre Prekondisi untuk fungsi ...
* / fungsi bool ( int arg1, const char * arg2)