An end to implicit fall-throughs in the kernel
An end to implicit fall-throughs in the kernel
Posted Aug 5, 2019 15:50 UTC (Mon) by rweikusat2 (subscriber, #117920)In reply to: An end to implicit fall-throughs in the kernel by karkhaz
Parent article: An end to implicit fall-throughs in the kernel
I would suspect assumptions based on how multiway conditionals work in other languages, eg, Pascal or the Bourne shell language, here. Such a construct can be emulated in C by combining switch and break but it doesn't have one. OTOH, a C switch can be used to do things which can't be done with a multiway conditional, eg,
switch ((uintptr_t)p & 3) {
case 3:
*p++ = c;
case 2:
*p++ = c;
case 1:
*p++ = c;
}
to align a pointer while storing some values (I'm aware that this is not standardized C).
One could argue that such cases are rare and that a proper multiway conditional had been a better idea.