by ars · 6y ago · 0 comments
I also can't seem to get there with a plain goto. I can't jump out either. Probably the computed goto extension will do the job, but that is cheating.
There's also the C programmers that come from assembler for whom the construction expressed by Duff's device is very natural. They would have a hard time believing that somebody find it surprising. For those people, it is obvious that the code should compile and its meaning is clear, as can be mapped directly to the compiled code.
switch (count % 8) {
turns into jmp [QWORD PTR .L4[0+rdx*8]]
just like you'd do if you were doing the assembly by hand.