From: Phil Carmody on
Tim Streater <timstreater(a)waitrose.com> writes:
> In article
> <dda9d933-e9c1-418f-b62a-bc30bd1dd16c(a)r27g2000yqn.googlegroups.com>,
> Ali Karaali <alicpp(a)gmail.com> wrote:
>
>> I use goto to break nested for loops and I can't see a
>> reason to ban goto.
>>
>> Ali
>>
>> On 24 Nisan, 13:13, "io_x" <a...(a)b.c.invalid> wrote:
>> > [Xpost to: alt.comp.programming, alt.lang.asm,
>> > comp.lang.c, comp.lang.c++, comp.programming]
>> >
>> > the people that speak not good about "goto"
>> > are uttled wrong; their code bug full etc
>> >
>> > more distant is your code from goto
>> > more your code is bug full and incompresible
>> >
>> > the "goto" is the key word for programming;
>> > all the remain, other than goto or jmp or jc or jz,
>> > and the easy cpu layout
>> > is the wrong way for programming
>> >
>> > i advise all you
>> > Good Morning
>
> I haven't used a goto since 1978 (when I stopped writing FORTRAN).

I'm with Knuth. I've reviewed patches and told the submitter to
just convert all his jumble of 'structure' into nice clean goto
statements many times this year. I don't use it for my own code,
but $DAYJOB has a clear coding style that recommends goto in
many situations. If goto has made your function unreadable, it
was probably too big and unreadable anyway.

Phil
--
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1
From: James Kanze on
On Apr 24, 10:26 pm, Phil Carmody <thefatphil_demun...(a)yahoo.co.uk>
wrote:
> Tim Streater <timstrea...(a)waitrose.com> writes:
> > I haven't used a goto since 1978 (when I stopped writing
> > FORTRAN).

Me neither.

> I'm with Knuth.

In other words, if goto makes the code simpler, it means that
you haven't found the correct expression of the algorithm.

And of course, the problem isn't with goto, per se. It's with
the way it is used. But because it can be abused so badly,
modern languages (including C and C++) provide all of the
necessary structures (and then some) so you don't have to use
it.

> I've reviewed patches and told the submitter to just convert
> all his jumble of 'structure' into nice clean goto statements
> many times this year. I don't use it for my own code, but
> $DAYJOB has a clear coding style that recommends goto in many
> situations. If goto has made your function unreadable, it was
> probably too big and unreadable anyway.

If goto seems necessary, it's because your function is too big
and unreadable.

--
James Kanze
From: Mensanator on
On Apr 24, 12:48 pm, "io_x" <a...(a)b.c.invalid> wrote:
> "Mensanator" ha scritto nel messaggionews:5fd893eb-9dda-4c70-bf56-614b0f721874(a)u34g2000yqu.googlegroups.com...
> On Apr 24, 5:13 am, "io_x" <a...(a)b.c.invalid> wrote:
>
>
>
>
>
> >> [Xpost to: alt.comp.programming, alt.lang.asm,
> >> comp.lang.c, comp.lang.c++, comp.programming]
>
> >> the people that speak not good about "goto"
> >> are uttled wrong; their code bug full etc
>
> >> more distant is your code from goto
> >> more your code is bug full and incompresible
>
> >> the "goto" is the key word for programming;
> >> all the remain, other than goto or jmp or jc or jz,
> >> and the easy cpu layout
> >> is the wrong way for programming
>
> >> i advise all you
> >> Good Morning
> >Yeah, there's nothing more fun than converting BASIC to Pascal.
>
> >Only to discover that goto was used to return from a sub-routine
> >without clearing the stack.
>
> all programming is all about choose the right gotos

No, it's not.

> and how to write them in the page.

Bullshit.

> point, end of programming difficulies,

You wish.

> there is nothing to say

Then why don't you shut up and quit saying it.
No one is interested in your prattle.
From: James Kanze on
On Apr 24, 1:20 pm, "Leigh Johnston" <le...(a)i42.co.uk> wrote:
> "spinoza1111" <spinoza1...(a)yahoo.com> wrote in message

> news:051fa27d-5cf8-4f7e-94c8-e9e5b26566b7(a)g34g2000pro.googlegroups.com...

> > On Apr 24, 6:06 pm, Ali Karaali <ali...(a)gmail.com> wrote:
> >> I use goto to break nested for loops and I can't see a
> >> reason to ban goto.

> > Why not use break instead? Does the same thing, spares you
> > from having to define a label.

> Because break only breaks out of the innermost loop, using
> goto to break out of nested loops is one of the few sensible
> uses of goto.

But when do you have to break out of a nested loop? (And of
course, the only valid use of break in C++ is to end a case in a
switch. Otherwise, it's just a goto in disguise.)

--
James Kanze
From: James Kanze on
On Apr 24, 5:12 pm, "Daniel T." <danie...(a)earthlink.net> wrote:
> "Leigh Johnston" <le...(a)i42.co.uk> wrote:

[...]
> In C and C++, goto is sufficiently restricted that as long as
> your functions are small, it is largely harmless.

In C and C++, if your functions are small enough, goto is
largely harmless. And also useless. All of the examples I've
seen defending goto introduce excessively complex functions in
order to justify it.

--
James Kanze