Skip to content

Commit

Permalink
CODING_STYLE: Mention preferred comment form
Browse files Browse the repository at this point in the history
Our defacto coding style strongly prefers /* */ style comments
over the single-line // style, and checkpatch enforces this,
but we don't actually document this. Mention it in CODING_STYLE.

Suggested-by: Thomas Huth <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
  • Loading branch information
pm215 authored and Michael Tokarev committed Feb 28, 2017
1 parent a6e3707 commit 25ac5bb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CODING_STYLE
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ if (a == 1) {
Rationale: Yoda conditions (as in 'if (1 == a)') are awkward to read.
Besides, good compilers already warn users when '==' is mis-typed as '=',
even when the constant is on the right.

7. Comment style

We use traditional C-style /* */ comments and avoid // comments.

Rationale: The // form is valid in C99, so this is purely a matter of
consistency of style. The checkpatch script will warn you about this.

0 comments on commit 25ac5bb

Please sign in to comment.