commit 506d119c16135b3bb352c2dad1c902646c18de75
parent 753adcc66cb2210e292e67500142f3d9f1b45543
Author: bfredl <bjorn.linse@gmail.com>
Date: Sat, 7 Oct 2023 20:57:55 +0200
Merge pull request #25533 from famiu/docs/style/abort-default
docs: use `abort()` for unreachable `default:` case in C
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt
@@ -846,7 +846,7 @@ Annotate non-trivial fall-through between cases.
If not conditional on an enumerated value, switch statements should always
have a `default` case (in the case of an enumerated value, the compiler will
warn you if any values are not handled). If the default case should never
-execute, simply `assert`: >c
+execute, simply use `abort()`: >c
switch (var) {
case 0:
@@ -856,7 +856,7 @@ execute, simply `assert`: >c
...
break;
default:
- assert(false);
+ abort();
}
Return Values ~