Skip to content

Commit f406af3

Browse files
committed
Merge pull request #4016
8414cb0 Doxygen-compatible comments in coding style (Wladimir J. van der Laan)
2 parents 4c6cab2 + 8414cb0 commit f406af3

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

doc/coding.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,61 @@ Common types:
4343
set set or multiset
4444
bn CBigNum
4545

46-
-------------------------
46+
Doxygen comments
47+
-----------------
48+
49+
To facilitate the generation of documentation, use doxygen-compatible comment blocks for functions, methods and fields.
50+
51+
For example, to describe a function use:
52+
```c++
53+
/**
54+
* ... text ...
55+
* @param[in] arg1 A description
56+
* @param[in] arg2 Another argument description
57+
* @pre Precondition for function...
58+
*/
59+
bool function(int arg1, const char *arg2)
60+
```
61+
A complete list of `@xxx` commands can be found at http://www.stack.nl/~dimitri/doxygen/manual/commands.html.
62+
As Doxygen recognizes the comments by the delimiters (`/**` and `*/` in this case), you don't
63+
*need* to provide any commands for a comment to be valid, just a description text is fine.
64+
65+
To describe a class use the same construct above the class definition:
66+
```c++
67+
/**
68+
* Alerts are for notifying old versions if they become too obsolete and
69+
* need to upgrade. The message is displayed in the status bar.
70+
* @see GetWarnings()
71+
*/
72+
class CAlert
73+
{
74+
```
75+
76+
To describe a member or variable use:
77+
```c++
78+
int var; //!< Detailed description after the member
79+
```
80+
81+
Also OK:
82+
```c++
83+
///
84+
/// ... text ...
85+
///
86+
bool function2(int arg1, const char *arg2)
87+
```
88+
89+
Not OK (used plenty in the current source, but not picked up):
90+
```c++
91+
//
92+
// ... text ...
93+
//
94+
```
95+
96+
A full list of comment syntaxes picked up by doxygen can be found at http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html,
97+
but if possible use one of the above styles.
98+
4799
Locking/mutex usage notes
100+
-------------------------
48101

49102
The code is multi-threaded, and uses mutexes and the
50103
LOCK/TRY_LOCK macros to protect data structures.
@@ -60,8 +113,8 @@ between the various components is a goal, with any necessary locking
60113
done by the components (e.g. see the self-contained CKeyStore class
61114
and its cs_KeyStore lock for example).
62115

63-
-------
64116
Threads
117+
-------
65118

66119
- ThreadScriptCheck : Verifies block scripts.
67120

0 commit comments

Comments
 (0)