3 ms·
(I _like_ using goto's every once in a while: it can often mess up the gcc optimizer just enough to get better code out of it. In this case, as the signal test
by throwaway29303 5y ago
(I _like_ using goto's every once in a while: it can often mess up the gcc optimizer just enough to get better code out of it. In this case, as the signal test is not usually true, the goto forces gcc to use better jump placement and avoid the branch in the usual case).
As to whether it reall matters: no, it doesn't. The largest reason I do this once in a while is that I look at the assembly gcc produces for quite other reasons, and use a goto to make it slightly easier to read (not the C code, the assembly ;-)
http://lkml.iu.edu/hypermail/linux/kernel/9507/0475.html http://lkml.iu.edu/hypermail/linux/kernel/9507/0475.html
Please note that this is from 1995. Compiler behaviour might have changed.
Other interesting posts:
https://marc.info/?l=linux-kernel&m=104240115806388&w=2 https://marc.info/?l=linux-kernel&m=104240115806388&w=2
https://marc.info/?l=linux-kernel&m=104240357108566&w=2 https://marc.info/?l=linux-kernel&m=104240357108566&w=2
https://marc.info/?l=linux-kernel&m=104240441009296&w=2 https://marc.info/?l=linux-kernel&m=104240441009296&w=2
- ThrowawayR2 5y agoThere's a one-page version of the latter conversation: https://koblents.com/Ches/Links/20-Using-Goto-in-Linux-Kernel-Code/ https://koblents.com/Ches/Links/20-Using-Goto-in-Linux-Kerne...