|
|
|
|
|
by gwmnxnp_516a
1801 days ago
|
|
Well, goto in this case is not that bad. Without goto the Linux code would be full of many nested if-else, what would lead to more bugs, as C lacks C++ RAAI (Resource-Acquisition-Is-Initialization) feature that allows usage of class destructors for executing actions at the end of scope such as releasing resources and deallocating memory. Besides Linux kernel, Goto is widely used on C programming for embedded systems for error handling, managing resources and creating finite state machines. It is possible to use RAAI in C, but only with GCC proprietary features that will make the code non portable to other C compilers. In this article John Rehger makes the case for GOTO - https://blog.regehr.org/archives/894. |
|