diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/dev_style.txt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index 79e758a11e..0bc27ced15 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -859,6 +859,33 @@ execute, simply use `abort()`: >c abort(); } +Switch statements that are conditional on an enumerated value should not have +a `default` case if it is exhaustive. Explicit case labels are preferred over +`default`, even if it leads to multiple case labels for the same code. For +example, instead of: >c + + case A: + ... + case B: + ... + case C: + ... + default: + ... + +You should use: >c + + case A: + ... + case B: + ... + case C: + ... + case D: + case E: + case F: + ... + Return Values ~ Do not needlessly surround the `return` expression with parentheses. |