Skip to content

Commit 1d57117

Browse files
authored
Merge pull request #21831 from crasbe/pr/cc_comments
CODING_CONVENTIONS: Add more Info about Comment Styles
2 parents 4b55480 + a1ccbab commit 1d57117

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

CODING_CONVENTIONS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,33 @@ int timeout = TIMEOUT_INTERVAL * USEC_PER_SEC;
391391
```
392392
## Comments
393393
* All comments should be written as C-style comments.
394+
* Long multi-Line comments should have a leading asterisk for the second and
395+
following lines. The first and last lines should be left empty and not contain
396+
any comment text.
397+
See also: [Linux Kernel Coding Style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html#commenting).
398+
* For short multi-line comments of two or three lines, a shorter style is
399+
also permissible, where the first and last line do not need to be left empty.
394400

395401
E.g:
396402
```c
397403
/* This is a C-style comment */
404+
405+
/* This is a short
406+
* multi-line comment (max 2-3 lines). */
407+
408+
/*
409+
* This is a long multi-
410+
* line comment for more
411+
* than three lines of
412+
* comment text.
413+
*/
398414
```
399415
Wrong:
400416
```c
401417
// C++ comment here
418+
419+
/* This is a multi-line comment
420+
without leading asterisk. */
402421
```
403422

404423
## Documentation

0 commit comments

Comments
 (0)