On Sun, 2005-08-07 at 23:43 +0200, Jan Hudec wrote: > On Sun, Aug 07, 2005 at 15:13:18 +0200, Bob Smith wrote: > > Hi, > > > > There are numerous places in the Linux Kernel where the > > C_Programming_Books_Most_Dreaded statement ('goto' of course) > > is used. > > Most C programming books are wrong in this point ;-). Goto is part of the Most C Programming books are correct in this point since they are written for *beginners* and it is far too easy to get unmaintainable and unreadable source code with 'goto'. And if your are understandable enought to use 'goto' without mis- or abusing it, you will know it (without a book). > language because it is useful at times and occasionaly even necessary. > The generic rule for readability is, that a construct that best represents > what's going on should be used. [....] > By the way, most of the time you could rewrite those gotos to ifs _without_ > introducing repetition, but it would still introduce many levels of > indentation, that would make the code unreadable. Actually most of the 'goto's (not only in the kernel but in general) could also (apart from the `if`) be rewritten with 'switch()' ... 'break;' (for forward jumps) and 'for(;;)', 'continue;' and 'break;' (if you need a backwards jump). But this doesn't make the code more readable. Bernd -- Firmix Software GmbH http://www.firmix.at/ mobil: +43 664 4416156 fax: +43 1 7890849-55 Embedded Linux Development and Services -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/