Re: on goto

Discussion in 'C++' started by James Dow Allen, Apr 25, 2010.

  1. On Apr 24, 9:10 pm, "Daniel T." <> wrote:
    > ...
    > everyone who is tempted to argue about this issue to start from
    > Dijkstra's paper rather than simply asserting that "goto is good"
    > without understanding the issues involved.
    >
    > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_
    > Harmful.html


    I did click the link, though I'm sure I'd read the paper a few times
    earlier.
    It has one key sentence which I think is now widely understood:
    Edsger W. Dijkstra wrote:
    > The unbridled use of the go to statement has an immediate consequence
    > that it becomes terribly hard to find a meaningful set of coordinates
    > in which to describe the process progress.


    (Hmmm. Dijkstra *does* write "UNBRIDLED use of goto". Funny how that
    disappears from the pedants' sound-bite summaries.)

    Dijkstra speaks of "meaningful ... coordinates ... to describe ..."
    I think that when state machines are implemented with goto's, the goto
    *helps* to map such "coordinates": the transition rules move you to
    state 36 so you ... GOTO state39!

    One of my own goto's appears horrendous, but is actually just
    a way to go to the appropriate progress point when the "meaningful
    coordinates" have been established:
    Pseudo-code comparison
    http://fabpedigree.com/james/gotoalt.htm
    Actual C code
    http://fabpedigree.com/james/dbldum.htm

    (Warning: if anyone *does* say anything good about my code,
    it will be a first, and I'll probably faint from the exhiliration!)

    > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_
    > Harmful.html


    PS: Your newswriter seems to have clipped the link, Daniel, which
    I then had to hand-enter. I think Google Groups would have gotten
    it right, so you may want to switch to that: :)
    > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html


    James Dow Allen
    James Dow Allen, Apr 25, 2010
    #1
    1. Advertising

  2. On Apr 25, 10:17 am, James Dow Allen <> wrote:
    > PS:  Your newswriter seems to have clipped the link, Daniel, which
    > I then had to hand-enter.  I think Google Groups would have gotten
    > it right, so you may want to switch to that:  :)


    Yes, Google's link did work. And yes, it was tongue-in-cheek of
    me to suggest you switch to Google. :)

    Nevertheless I will point out that some pedants delight in ranting
    at every Google bug. When Google gets it right and their news
    software doesn't, they seem to view the non-Google foibles as
    "treasured souvenirs of a bygone superior era." :)

    Just saying.
    James Dow Allen, Apr 25, 2010
    #2
    1. Advertising

  3. On Apr 25, 10:03 pm, "Daniel T." <> wrote:
    > James Dow Allen <> wrote:
    >> > understood: Edsger W. Dijkstra wrote:
    > > > The unbridled use of the go to statement has an immediate
    > > > consequence that it becomes terribly hard to find a meaningful set
    > > > of coordinates in which to describe the process progress.

    > .
    > > (Hmmm.  Dijkstra *does* write "UNBRIDLED use of goto".  Funny how that
    > > disappears from the pedants' sound-bite summaries.)

    > .
    > Agreed, and many also fail to notice that it is rather hard to use goto
    > in an "unbridled" fashion in C and C++.


    Did you mean "bridled"? ... Since you were arguing against goto.
    > .
    > > One of my own goto's appears horrendous...
    > >http://fabpedigree.com/james/dbldum.htm

    > .
    > It looks as though you have implemented a depth first search.


    Yes. Or rather backtracking, which is DFS with a smidgen
    of extra control logic. The problem specifics mean there's
    3 or 4 "smidgens" of extra control logic here. And in my
    comments I admit that there are better ways to deal with *simpler*
    backtracking problems, and better ways to deal with *harder*
    backtracking applications.

    > ... I fully agree that your code is better than the psudo-code you
    > present in comparison ...


    Well, thanks for that! The side-by-side comparison clearly shows
    that I use 1 goto and 1 for-loop to avoid 2 break's, 4 if's,
    2 else's and 2 other minor defects. I'm not arguing that goto's
    aren't bad, just that other things (break's, too many variables,
    etc.) are also bad and one seeks compromise.

    > there are better ways of implementing depth first searches
    > than either of the two you present.


    If you submit working code that runs slower than mine by no more
    than 20%, I will show it at the website as "Daniel's structured
    improvement." (Speed *is* important of course for the target
    application.)

    James
    James Dow Allen, Apr 26, 2010
    #3
  4. James Dow Allen

    Richard Bos Guest

    James Dow Allen <> wrote:

    > PS: Your newswriter seems to have clipped the link, Daniel, which
    > I then had to hand-enter. I think Google Groups would have gotten
    > it right, so you may want to switch to that: :)
    > > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_=

    > Harmful.html


    Except, of course, that it doesn't. Quoted-illegible: Just Say No.

    Richard
    Richard Bos, Apr 27, 2010
    #4
    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:
    604
    David Pursley
    Nov 18, 2003
  2. Skybuck Flying

    VHDL Goto statement ?

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

    Re: VHDL Goto statement ?

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

Share This Page