Is most of this thread happening in private or am I just missing some of
the responses?
Anyway, back to the (off) topic. GOTO isn't always a bad thing. Very handy
when you're allocating a bunch of resources sequentially and you want to
stop as soon as any allocation fails. This can of course be done with
nested ifs but if you're allocating 10 different things, that's 10 layers
of nesting.
They're also good for some complicated if/then/else stuff that would
otherwise need repeated code.
Also break (or last and next for Perl) are just dressed up GOTOs and
they'll only get you nicely out of 1 level of nesting of a loop.
They have their place. By the way, if you have an aversion to GOTOs don't
go anywhere near procmail's source, it's mind boggling,
Fergal
At 16:25 21/06/00, Philip Reynolds wrote:
>John P . Looney's [valen at tuatha.org] 16 lines of dribble included:
>:>On Wed, Jun 21, 2000 at 04:01:46PM +0100, Noel Carroll mentioned:
>:>> I wasn't knocking it... its just that in my case people used it for
>:>> everything. It was all anti-flow structure. You still have to use GOTO
>:>> in basic and its good and useful for that. I just wouldn't use it in
>C/C++
>:>> at all with the exception of exception handling or setjmp/longjmp stuff.
>:>>:> Look through the Linux source - therer are seventy+ gotos!
>>70+, there's a hell of a lot more than that in the full Linux source code last
>time I looked (2.2.15 kernel I think it was). Lots and lots and lots of gotos.
>Generally programs can do without goto statements, function blocks, if
>statements, switch statements etc. in C, can nearly always more than make up
>for gotos and make the code more readable as well.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!