On 1/11/21 8:05 PM, Ryan Libby wrote:
If these cases are never reachable, then I think '__assert_unreachable()'
is preferred to a plain break.

Hi,

I'll have to let wulf and hselasky speak to that...

__assert_unreachable() is a bit fresh in my opinion. Basically it comes down to a panic/assert when supposedly unreached cases are triggered.

commit c79cee71363ddaeb3c5ab7d3ccb87a11e1860d95
Author: Kyle Evans <kev...@freebsd.org>
Date:   Wed May 13 18:07:37 2020 +0000

    kernel: provide panicky version of __unreachable

I think:

default:
 break;

Or when you need:

/* FALLTHROUGH */

is perfectly fine, even though I see other OS'es even macrofy FALLTHROUGH as a built in compiler attribute.

Why do a) and not b) ?

Are there more things about switch cases we should do?

--HPS
_______________________________________________
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"

Reply via email to