3 ms·
If you are raising an error/exception, shouldn't you be doing that explicitly, instead of just outputting catch all error handling at the end of the routine? O
by run4yourlives 17y ago
If you are raising an error/exception, shouldn't you be doing that explicitly, instead of just outputting catch all error handling at the end of the routine?
Otherwise, we may as well just do: "on error resume next :-)"
- scott_s 17y agoThis is C, in the kernel. You can't "raise an exception." The gotos are necessary because kernel work requires allocating resources. If an error is hit, the function needs to exit, but it also needs to release its resources correctly. But, these resources need to be freed upon normal completion as well. Hence, gotos. You should probably read some of the code before saying it's bad. See, for example, the function that implements a memory map: http://miller.cs.wm.edu/lxr3.linux/http/source/mm/mmap.c?v=2.6.11.12#L864 http://miller.cs.wm.edu/lxr3.linux/http/source/mm/mmap.c?v=2...
- run4yourlives 17y agoWell, fair enough. My ignorance of C kernel programming is on display, but I'm pretty sure the topic was why we'd need goto's in PHP. Again, I'm not seeing any specific need.