Skip to contentSkip to conversation

CODING_STYLE: Mention preferred comment form

PATCH Applied Peter Maydell 6 participants 6 messages Feb 3, 2017 – Feb 15, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CODING_STYLE: Mention preferred comment form

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.

---
 CODING_STYLE | 7 +++++++
 1 file changed, 7 insertions(+)
CODING_STYLE +7 -0
index f53180b..2fa0c0b 100644
@@ -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.
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Peter Maydell

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.

---
 CODING_STYLE | 7 +++++++
 1 file changed, 7 insertions(+)
CODING_STYLE +0 -0
index f53180b..2fa0c0b 100644

CODING_STYLE if (a == 1) { · line 125

Quoted 10 lines
CODING_STYLE +7 -0
@@ -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.
Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Maydell
Quoted 15 lines · Peter Maydell

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.

---
 CODING_STYLE | 7 +++++++
 1 file changed, 7 insertions(+)
CODING_STYLE +0 -0
index f53180b..2fa0c0b 100644

CODING_STYLE if (a == 1) { · line 125

Quoted 10 lines
CODING_STYLE +7 -0
@@ -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.
Reviewed-by on v1 1/1
#3 lore raw
In reply to Peter Maydell
Quoted 16 lines · Peter Maydell

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.

---
 CODING_STYLE | 7 +++++++
 1 file changed, 7 insertions(+)
CODING_STYLE +0 -0
index f53180b..2fa0c0b 100644

CODING_STYLE if (a == 1) { · line 125

Quoted 10 lines
CODING_STYLE +7 -0
@@ -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.
Reviewed-by on v1 1/1
#4 lore raw
In reply to Peter Maydell
Quoted 9 lines · Peter Maydell

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.

---
 CODING_STYLE | 7 +++++++
 1 file changed, 7 insertions(+)
#5 lore raw
In reply to Peter Maydell
Quoted 3 lines · Peter Maydell

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.

Applied to -trivial, thanks!

/mjt