Re: how to emulate goto.

From: Andrew McDonagh (news_at_andrewcdonagh.f2s.com)
Date: 02/03/05


Date: Thu, 03 Feb 2005 20:31:13 +0000

Dimitri Maziuk wrote:
> Andrew McDonagh sez:
>
>>Dimitri Maziuk wrote:
>
> ....
>
>>>Meanwhile, goto changed its name to "continue break label" and
>>>everyone's using it in the happy ever after.
>>
>>yes, but 'continue break label' is not really a goto. It looks like one,
>>but it isn't.
>
>
> Riight. Looks like a duck, quacks like a duck (executes a jump
> to labelled instruction), must be a Belgian paratrooper.
>

take a look at the Thinking in Java book by Bruce Eckel

http://www.faqs.org/docs/think_java/TIJ305.htm#Heading3009

> I've seen enough crappy code without gotos and good code with
> gotos to know that the real problem is "programmers" who
> shouldn't be allowed within a nucular blast radius of a computer.
>

On this I completely agree. Most problems are down to inexperienced
developers rather than poor tools.

Having said that, if the tool makers find that certain things can be
improved to make them less likely to be abused by these developers, then
it may be worth it. This is the case with Java's break & continue, in
that they are 'like' a goto, but have tight constraints upon how and
when they can be used.



Relevant Pages

  • Re: Why is GOTO bad?
    ... For people who don't like GOTO, it is an existing real option. ... BREAK label or BREAK n is more flexible working with _ALL_ types of loop. ...
    (microsoft.public.vb.general.discussion)
  • Re: Why is GOTO bad?
    ... BREAK label or BREAK n is more flexible working with _ALL_ types of loop. ... "GOTO label"? ... With break label you can't accidentally jump inside ...
    (microsoft.public.vb.general.discussion)
  • Re: possible recursive locking detected - while running fs operations in loops - 2.6.18-
    ... Yes, it is quite useful, our developers have added it to the ... regression suite.... ... Now how about that lock validator message I managed to tease out? ... goto out; ...
    (Linux-Kernel)
  • Re: [PATCH 1/7] USB: gadget: file_storage: put_device() in error recovery
    ... most developers seem to prefer: ... goto out; ... Alan Stern ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)
  • Re: Java needs "goto" (was Re: hi)
    ... There are situations where "goto" would be very useful, ... An alternative to "break label" since label is currently limited in ... it always seems to make the code confusing. ... are confusing because the programmer (having labelled break available) didn't ...
    (comp.lang.java.programmer)