diff options
author | Richard Braun <rbraun@sceen.net> | 2017-06-25 14:25:44 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-06-25 14:25:44 +0200 |
commit | 308dae7cb2708e48699700556b0a49483097f262 (patch) | |
tree | 72b30290ca3e2c9a9d03bc259c646f70de13bfd2 | |
parent | cbb58c1daa596d10fa5d622f302e530fa42a02a1 (diff) |
doc/style(9): discuss increment and decrement operators
-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 --- |