summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-07-31 20:07:11 +0200
committerDaniel Mack <github@zonque.org>2015-07-31 20:07:11 +0200
commit97d09a62836e1c6f807837cf47e83c970cecb06b (patch)
tree5ecfe2ed59429b5ec3ebea3606903d6d5ff7cf27
parentc474a4ecfa74d90d02822d24efa310197a5c3298 (diff)
parentcad6982291a0e3cae4b8b1fad140ffd512e2835c (diff)
Merge pull request #815 from poettering/coding-style-for
CODING_STYLE: say that "for (;;)" is better than "while (1)"
-rw-r--r--CODING_STYLE7
1 files changed, 7 insertions, 0 deletions
diff --git a/CODING_STYLE b/CODING_STYLE
index dbadfbdb54..a96ddd3598 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -314,3 +314,10 @@
are always defined after more global ones. Thus, our local
definitions will never "leak" into the global header files, possibly
altering their effect due to #ifdeffery.
+
+- To implement an endless loop, use "for (;;)" rather than "while
+ (1)". The latter is a bit ugly anyway, since you probably really
+ meant "while (true)"... To avoid the discussion what the right
+ always-true expression for an infinite while() loop is our
+ recommendation is to simply write it without any such expression by
+ using "for (;;)".