switch
switch
Posted Sep 12, 2021 11:23 UTC (Sun) by HelloWorld (guest, #56129)In reply to: switch by tialaramex
Parent article: Cro: Maintain it With Zig
In safety critical applications, which after all typically run in some sort of embedded system, I don't think you even need something like #[non_exhaustive]. When a new enumerator is added, you really should take another look and not just hope that your old default clause still makes sense. Binary compatibility is not that much of an issue in embedded systems because you don't usually upgrade shared libraries independently.
Besides, this is purely a tooling problem. If MISRA wants to enforce exhaustiveness, they can do so. But apparently their tool vendors are just too lazy and they prefer forcing people to write dead code instead.
