On Fri, Jan 09, 2004 at 08:22:27 +0000, Anticipating a Reply wrote: > Hi , > > Just adding to the discussion of goto usage , > the below helps avoid using goto . > > > do { ... } while (0) ; > > > That is, it allows you to break out of the block > early if some condition is met, without defining > a label and using goto. > > Consider: > > do { > if (foo) > break; > > some(); > thing(); > which(); > takes(); > forever(); > } while (0); > > Cheers ! This won't work if the function already includes whiles or switches and if there is a deeper nesting, it's not immediately obvious, how many levels the break will exit -- it's much easier to find a label, which is indented from first column, than a closing brace matching innermost while, do or switch. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/