Re: on goto

Discussion in 'C++' started by Alexei A. Frounze, Apr 24, 2010.

  1. On Apr 24, 3:13 am, "io_x" <> 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


    Everything may be used, misused and abused, goto included. There are
    good and bad usage patterns and goto is not an exception here. I can
    list a number of other things that may be just as bad as a poorly used
    goto (or as good as a good goto). See?

    Alex
     
    Alexei A. Frounze, Apr 24, 2010
    #1
    1. Advertising

  2. "Alexei A. Frounze" <> writes:

    > On Apr 24, 3:13 am, "io_x" <> 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

    >
    > Everything may be used, misused and abused, goto included. There are
    > good and bad usage patterns and goto is not an exception here. I can
    > list a number of other things that may be just as bad as a poorly used
    > goto (or as good as a good goto). See?


    Indeed. For example, the Duff device is worse than most gotos I've
    ever seen.

    --
    __Pascal Bourguignon__
     
    Pascal J. Bourguignon, Apr 24, 2010
    #2
    1. Advertising

  3. On Apr 24, 10:48 am, "io_x" <> wrote:
    > "Alexei A. Frounze" ha scritto nel messaggionews:...
    >
    >
    >
    > >On Apr 24, 3:13 am, "io_x" <> 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

    > >Everything may be used, misused and abused, goto included. There are
    > >good and bad usage patterns and goto is not an exception here. I can
    > >list a number of other things that may be just as bad as a poorly used
    > >goto (or as good as a good goto). See?

    >
    > what does it mean "patterns"?


    Not sure what you mean here.

    > all programming is all about choose the right gotos


    If your programs consisted only of gotos (as I infer from the above),
    they would be useless. Programming is not all about choosing the right
    gotos. Less so all programming. It's about many more things.

    Alex
     
    Alexei A. Frounze, Apr 24, 2010
    #3
  4. Alexei A. Frounze

    James Kanze Guest

    On Apr 24, 1:16 pm, (Pascal J. Bourguignon)
    wrote:
    > "Alexei A. Frounze" <> writes:


    [...]
    > > Everything may be used, misused and abused, goto included.
    > > There are good and bad usage patterns and goto is not an
    > > exception here. I can list a number of other things that may
    > > be just as bad as a poorly used goto (or as good as a good
    > > goto). See?


    Except that we're talking about C and C++ here, and in C and in
    C++, for all "good" uses of goto (and a number of bad ones), the
    language has specialized structures which better express the
    meaning.

    > Indeed. For example, the Duff device is worse than most gotos
    > I've ever seen.


    And it's fully structured:).

    Seriously, Duff himself said that it was an argument concerning
    the way C implemented switch, but he wasn't sure whether it was
    an argument for or against. (And it should probably be pointed
    out that Duff used it to solve one very special problem, with
    one specific compiler---his code almost certainly wouldn't work
    correctly with any modern compiler.)

    --
    James Kanze
     
    James Kanze, Apr 24, 2010
    #4
  5. James Kanze <> writes:

    > On Apr 24, 1:16 pm, (Pascal J. Bourguignon)
    > wrote:
    >> "Alexei A. Frounze" <> writes:

    >
    > [...]
    >> > Everything may be used, misused and abused, goto included.
    >> > There are good and bad usage patterns and goto is not an
    >> > exception here. I can list a number of other things that may
    >> > be just as bad as a poorly used goto (or as good as a good
    >> > goto). See?

    >
    > Except that we're talking about C and C++ here, and in C and in
    > C++, for all "good" uses of goto (and a number of bad ones), the
    > language has specialized structures which better express the
    > meaning.
    >
    >> Indeed. For example, the Duff device is worse than most gotos
    >> I've ever seen.

    >
    > And it's fully structured:).
    >
    > Seriously, Duff himself said that it was an argument concerning
    > the way C implemented switch, but he wasn't sure whether it was
    > an argument for or against. (And it should probably be pointed
    > out that Duff used it to solve one very special problem, with
    > one specific compiler---his code almost certainly wouldn't work
    > correctly with any modern compiler.)


    Well, it would depend on the C standard (perhaps the later
    specifications changed), but AFAIK, this is the way C is specified, and
    the Duff device should work on all compliant compiler.

    --
    __Pascal Bourguignon__
     
    Pascal J. Bourguignon, Apr 25, 2010
    #5
  6. "James Kanze" <> wrote in message
    news:...
    >
    > Except that we're talking about C and C++ here, and in C and in
    > C++, for all "good" uses of goto (and a number of bad ones), the
    > language has specialized structures which better express the
    > meaning.
    >


    The post was cross-posted to five groups. You're seeing posts from a.l.a
    and elsewhere - people uninterested in or unaware of C/C++.

    I've removed the non-C/C++ groups on this post, I don't care to hear from a
    few people on c.l.c. BTW, I also won't see a reply...

    > Seriously, Duff himself said that it was an argument concerning
    > the way C implemented switch, but he wasn't sure whether it was
    > an argument for or against. (And it should probably be pointed
    > out that Duff used it to solve one very special problem, with
    > one specific compiler---his code almost certainly wouldn't work
    > correctly with any modern compiler.)
    >


    If it doesn't work for C, that C compiler is _broken_. Nothing has changed
    in C regarding the syntax he used. It's possible that it doesn't work for
    C++, but then various aspects of C don't work correctly in C++ either...


    Rod Pemberton
     
    Rod Pemberton, Apr 25, 2010
    #6
  7. Alexei A. Frounze

    tonydee Guest

    On Apr 25, 7:47 am, James Kanze <> wrote:
    > [...] in C and in
    > C++, for all "good" uses of goto (and a number of bad ones), the
    > language has specialized structures which better express the
    > meaning.


    Just not so. Much low-level state-based code is best expressed via
    gotos. There are a couple hundred usages spread over 7 different
    Boost libraries (as of 1.41). Have a look and you might find
    something you think reasonable. Sometimes working too much in a
    particular set of problem domains can either make it seem like goto
    isn't beneficial, or make it completely obvious it is. Parsers are
    one area where the uses are clear, for example: the boost regex
    parser. Similarly, some lexers I've written have employed gotos
    too... it's just cleaner. I'm pretty sure Walter Bright chipped in on
    an argument like this a couple years back, also supporting some uses
    of gotos... not somebody who's experience I'd challenge - will try to
    dig up the reference if anyone cares....

    Cheers,
    Tony
     
    tonydee, Apr 28, 2010
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. youngsun park
    Replies:
    2
    Views:
    645
    David Pursley
    Nov 18, 2003
  2. Skybuck Flying

    VHDL Goto statement ?

    Skybuck Flying, Aug 8, 2005, in forum: VHDL
    Replies:
    9
    Views:
    6,364
    ajahn
    Aug 26, 2005
  3. Skybuck Flying

    Re: VHDL Goto statement ?

    Skybuck Flying, Aug 8, 2005, in forum: VHDL
    Replies:
    0
    Views:
    774
    Skybuck Flying
    Aug 8, 2005
  4. Flip
    Replies:
    6
    Views:
    6,753
    Jeff Dillon
    Nov 18, 2004
  5. Flip
    Replies:
    1
    Views:
    672
    Brock Allen
    Apr 14, 2005
Loading...

Share This Page