diff options
-rw-r--r-- | doc/style.9.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/style.9.txt b/doc/style.9.txt index 51ff0432..93683d8c 100644 --- a/doc/style.9.txt +++ b/doc/style.9.txt @@ -644,6 +644,17 @@ Side effects and conditions Conditions must never be made of expressions with side effects. This completely removes the need to think about short-circuit evaluations. +Increment/decrement operators +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Increment and decrement operators may never be used inside larger expressions. +Their usage as expression-3 of a for loop is considered as an entire expression +and doesn't violate this rule. The rationale is to avoid tricky errors related +to sequence points. Since such operators may not be used inside larger +expressions, there is no difference between prefix and postfix operators. +The latter are preferred because they look more object-oriented, somewhat +matching the object.method() syntax. + SEE --- |