Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #21522 > unrolled thread
| Started by | mike3 <mike4ty4@yahoo.com> |
|---|---|
| First post | 2012-05-29 22:44 -0700 |
| Last post | 2012-06-06 08:12 -0700 |
| Articles | 20 on this page of 133 — 38 participants |
Back to article view | Back to comp.lang.c
Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-29 22:44 -0700
Re: Error returns and repeated code, GOTOs, etc. Ike Naar <ike@sverige.freeshell.org> - 2012-05-30 06:38 +0000
Re: Error returns and repeated code, GOTOs, etc. Nils M Holm <news2009@t3x.org> - 2012-05-30 06:57 +0000
Re: Error returns and repeated code, GOTOs, etc. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-05-30 00:52 -0700
Re: Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-30 01:50 -0700
Re: Error returns and repeated code, GOTOs, etc. MarkBluemel <mark_bluemel@pobox.com> - 2012-05-30 09:55 +0100
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-05-30 09:18 +0000
Re: Error returns and repeated code, GOTOs, etc. tom st denis <tom@iahu.ca> - 2012-05-30 05:16 -0700
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-05-30 16:26 +0000
Re: Error returns and repeated code, GOTOs, etc. tom st denis <tom@iahu.ca> - 2012-06-01 08:05 -0700
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-06-03 11:24 +0000
Re: Error returns and repeated code, GOTOs, etc. jgk@panix.com (Joe keane) - 2012-06-02 13:54 +0000
Re: Error returns and repeated code, GOTOs, etc. Jean-Christophe <5.d@free.fr> - 2012-06-02 07:24 -0700
Re: Error returns and repeated code, GOTOs, etc. jgk@panix.com (Joe keane) - 2012-06-02 16:37 +0000
Re: Error returns and repeated code, GOTOs, etc. Jean-Christophe <5.d@free.fr> - 2012-06-02 12:46 -0700
Re: Error returns and repeated code, GOTOs, etc. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 15:42 +0100
Re: Error returns and repeated code, GOTOs, etc. jgk@panix.com (Joe keane) - 2012-06-02 19:35 +0000
Re: Error returns and repeated code, GOTOs, etc. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-03 03:53 +0100
Re: Error returns and repeated code, GOTOs, etc. Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-06-11 18:10 +0300
Re: Error returns and repeated code, GOTOs, etc. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-11 16:19 +0100
Re: Error returns and repeated code, GOTOs, etc. Martin Shobe <martin.shobe@yahoo.com> - 2012-06-02 19:27 +0000
Re: Error returns and repeated code, GOTOs, etc. jgk@panix.com (Joe keane) - 2012-06-03 23:48 +0000
Re: Error returns and repeated code, GOTOs, etc. Ian Collins <ian-news@hotmail.com> - 2012-06-04 11:53 +1200
Re: Error returns and repeated code, GOTOs, etc. Martin Shobe <martin.shobe@yahoo.com> - 2012-06-04 03:32 +0000
Re: Error returns and repeated code, GOTOs, etc. nick_keighley_nospam@hotmail.com - 2012-05-30 07:25 -0700
Re: Error returns and repeated code, GOTOs, etc. falk@rahul.net (Edward A. Falk) - 2012-06-05 07:20 +0000
Re: Error returns and repeated code, GOTOs, etc. Ian Collins <ian-news@hotmail.com> - 2012-05-30 21:50 +1200
Re: Error returns and repeated code, GOTOs, etc. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-05-30 03:34 -0700
Re: Error returns and repeated code, GOTOs, etc. Ian Collins <ian-news@hotmail.com> - 2012-05-30 22:57 +1200
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-05-30 11:04 +0000
Re: Error returns and repeated code, GOTOs, etc. nick_keighley_nospam@hotmail.com - 2012-05-30 04:53 -0700
Re: Error returns and repeated code, GOTOs, etc. "BartC" <bc@freeuk.com> - 2012-05-30 13:28 +0100
Re: Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-30 13:57 -0700
Re: Error returns and repeated code, GOTOs, etc. "io_x" <a@b.c.invalid> - 2012-05-30 15:19 +0200
Re: Error returns and repeated code, GOTOs, etc. Mark Bluemel <mark.bluemel@googlemail.com> - 2012-05-31 01:10 -0700
Re: Error returns and repeated code, GOTOs, etc. "io_x" <a@b.c.invalid> - 2012-06-02 17:34 +0200
Re: Error returns and repeated code, GOTOs, etc. "io_x" <a@b.c.invalid> - 2012-06-03 10:33 +0200
Re: Error returns and repeated code, GOTOs, etc. Ike Naar <ike@iceland.freeshell.org> - 2012-05-30 13:56 +0000
Re: Error returns and repeated code, GOTOs, etc. Kulin <remailer@reece.net.au> - 2012-05-30 17:29 +0000
Re: Error returns and repeated code, GOTOs, etc. ImpalerCore <jadill33@gmail.com> - 2012-05-30 07:13 -0700
Re: Error returns and repeated code, GOTOs, etc. Thad Smith <ThadSmith@acm.org> - 2012-06-02 07:20 -0600
Re: Error returns and repeated code, GOTOs, etc. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-30 16:37 +0100
Re: Error returns and repeated code, GOTOs, etc. Johann Klammer <klammerj@NOSPAM.a1.net> - 2012-05-30 19:05 +0200
Re: Error returns and repeated code, GOTOs, etc. Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-31 13:19 -0700
Re: Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-31 13:49 -0700
Re: Error returns and repeated code, GOTOs, etc. "BartC" <bc@freeuk.com> - 2012-05-31 22:08 +0100
Re: Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-31 16:08 -0700
Re: Error returns and repeated code, GOTOs, etc. Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-31 17:34 -0700
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-06-01 07:40 +0000
GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) mike3 <mike4ty4@yahoo.com> - 2012-05-31 16:39 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-01 03:21 +0100
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-01 03:49 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 02:15 +0100
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-01 19:45 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 15:00 +0100
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-02 16:44 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-03 03:51 +0100
Re: GOTOs discovered in "real world" program! "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-01 12:06 -0400
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 02:01 +0100
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-01 19:46 -0700
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-01 21:19 -0700
Re: GOTOs discovered in "real world" program! blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2012-06-02 16:35 +0000
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 14:50 +0100
Re: GOTOs discovered in "real world" program! Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-02 07:04 -0700
Re: GOTOs discovered in "real world" program! "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-02 04:37 -0500
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-02 03:40 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 14:46 +0100
Re: GOTOs discovered in "real world" program! "BartC" <bc@freeuk.com> - 2012-06-02 17:10 +0100
Re: GOTOs discovered in "real world" program! Robert Wessel <robertwessel2@yahoo.com> - 2012-06-02 11:35 -0500
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "BartC" <bc@freeuk.com> - 2012-06-02 09:46 +0100
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "io_x" <a@b.c.invalid> - 2012-06-03 10:43 +0200
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "BartC" <bc@freeuk.com> - 2012-06-03 10:58 +0100
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "io_x" <a@b.c.invalid> - 2012-06-03 17:18 +0200
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) jgk@panix.com (Joe keane) - 2012-06-04 20:40 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) jgk@panix.com (Joe keane) - 2012-06-05 01:03 +0000
Re: GOTOs discovered in "real world" program! Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-06-04 21:36 -0600
Re: GOTOs discovered in "real world" program! jgk@panix.com (Joe keane) - 2012-06-05 15:13 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Ike Naar <ike@sverige.freeshell.org> - 2012-06-05 08:12 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) James Kuyper <jameskuyper@verizon.net> - 2012-06-05 06:00 -0400
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) jgk@panix.com (Joe keane) - 2012-06-05 02:05 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Martin Shobe <martin.shobe@yahoo.com> - 2012-06-05 03:16 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "io_x" <a@b.c.invalid> - 2012-06-03 17:30 +0200
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Jean-Christophe <5.d@free.fr> - 2012-06-03 09:02 -0700
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-03 22:37 +0100
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Ike Naar <ike@iceland.freeshell.org> - 2012-06-04 07:28 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-08 01:28 -0700
Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) mike3 <mike4ty4@yahoo.com> - 2012-06-06 02:54 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-06 13:14 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) pete <pfiland@mindspring.com> - 2012-06-06 09:22 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Willem <willem@toad.stack.nl> - 2012-06-06 13:49 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Rui Maciel <rui.maciel@gmail.com> - 2012-06-06 14:56 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-06 10:17 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Angel <angel+news@spamcop.net> - 2012-06-06 13:06 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) mike3 <mike4ty4@yahoo.com> - 2012-06-07 16:26 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Angel <angel+news@spamcop.net> - 2012-06-08 14:26 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) mike3 <mike4ty4@yahoo.com> - 2012-06-08 15:19 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Angel <angel+news@spamcop.net> - 2012-06-08 23:32 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "BartC" <bc@freeuk.com> - 2012-06-09 01:14 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Jean-Christophe <5.d@free.fr> - 2012-06-09 04:36 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-09 05:54 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "BartC" <bc@freeuk.com> - 2012-06-09 16:12 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-09 08:44 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-10 18:23 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-10 19:42 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-14 18:00 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-11 01:14 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-12 08:01 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-12 05:27 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-12 08:44 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) jgk@panix.com (Joe keane) - 2012-06-11 17:24 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "BartC" <bc@freeuk.com> - 2012-06-11 19:02 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) jgk@panix.com (Joe keane) - 2012-06-12 20:03 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-13 00:58 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-13 06:37 -0400
Evil in Programming Was: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-13 04:50 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) gwowen <gwowen@gmail.com> - 2012-06-13 07:02 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Les Cargill <lcargill99@comcast.com> - 2012-06-13 12:47 -0500
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-13 14:17 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Willem <willem@toad.stack.nl> - 2012-06-13 19:44 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-13 15:52 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Les Cargill <lcargill99@comcast.com> - 2012-06-13 17:45 -0500
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-13 19:07 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) jgk@panix.com (Joe keane) - 2012-06-14 23:03 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Kaz Kylheku <kaz@kylheku.com> - 2012-06-14 23:25 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Les Cargill <lcargill99@comcast.com> - 2012-06-14 19:25 -0500
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) 88888 Dihedral <dihedral88888@googlemail.com> - 2012-06-17 20:32 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-18 01:30 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Les Cargill <lcargill99@comcast.com> - 2012-06-18 07:06 -0500
Re: Why was there a GOTO? Gareth Owen <gwowen@gmail.com> - 2012-06-13 19:57 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) jgk@panix.com (Joe keane) - 2012-06-10 16:56 +0000
Another problem (was Re: Error returns and repeated code, GOTOs, etc.) mike3 <mike4ty4@yahoo.com> - 2012-05-31 16:46 -0700
Re: Another problem (was Re: Error returns and repeated code, GOTOs, etc.) Ian Collins <ian-news@hotmail.com> - 2012-06-01 15:55 +1200
Re: Error returns and repeated code, GOTOs, etc. gwowen <gwowen@gmail.com> - 2012-06-06 08:12 -0700
Page 4 of 7 — ← Prev page 1 2 3 [4] 5 6 7 Next page →
| From | mike3 <mike4ty4@yahoo.com> |
|---|---|
| Date | 2012-06-01 21:19 -0700 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <fc325350-fecd-4c33-a0f7-29c3faad1208@tx6g2000pbc.googlegroups.com> |
| In reply to | #21643 |
On Jun 1, 8:46 pm, mike3 <mike4...@yahoo.com> wrote: > On Jun 1, 7:01 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: > > > "Aaron W. Hsu" <arcf...@sacrideo.us> writes: > <snip> > > Both are models of clarity, and neither is dogmatic. I feel sure that > > if all gotos in all programs had been as well-reasoned for as those in > > Knuth's paper, Dijkstra would never have written his. > > But I take it that, from what I've seen on this thread, using gotos to > jump to error code handlers is _not_ a "well-reasoned" use, right, and > so > Djikstra's rules still apply? ^^^^^^^^^ Damn, I did it again! Dijkstra, oops. :(
[toc] | [prev] | [next] | [standalone]
| From | blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> |
|---|---|
| Date | 2012-06-02 16:35 +0000 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <a2utltFgdhU2@mid.individual.net> |
| In reply to | #21644 |
In article <fc325350-fecd-4c33-a0f7-29c3faad1208@tx6g2000pbc.googlegroups.com>, mike3 <mike4ty4@yahoo.com> wrote: > On Jun 1, 8:46 pm, mike3 <mike4...@yahoo.com> wrote: [ snip ] > > Djikstra's rules still apply? > ^^^^^^^^^ > Damn, I did it again! Dijkstra, oops. :( Maybe you will find the following useful as a way of remembering (I *think* I got this from a native speaker of Dutch, though I may be misremembering): "Dykstra" might be a more logical spelling, and the "i" and "j" together look sort of like a "y". FWIW? -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2012-06-02 14:50 +0100 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <0.62b284cd8f40969470eb.20120602150111BST.87obp1ertk.fsf@bsb.me.uk> |
| In reply to | #21643 |
mike3 <mike4ty4@yahoo.com> writes: > On Jun 1, 7:01 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: >> "Aaron W. Hsu" <arcf...@sacrideo.us> writes: > <snip> >> Both are models of clarity, and neither is dogmatic. I feel sure that >> if all gotos in all programs had been as well-reasoned for as those in >> Knuth's paper, Dijkstra would never have written his. > > But I take it that, from what I've seen on this thread, using gotos to > jump to error code handlers is _not_ a "well-reasoned" use, right, A well-reasoned use needs reasoning. Your recent example did not include any reasoning, just a slightly facetious remark that you'd found a goto in real code (multiple exclamation marks!!!). In certain cases, depending on the logic, the case for a jump to a block of common clean-up code can be made. It needs care to get it right since you are often cleaning up an incomplete configuration using variables whose cope is, by definition, nearly all of (and in C90 is all of) the function body. Your example was a bad one because the jump-free version is, to my mind, clearer and simpler. > and so Djikstra's rules still apply? (You've corrected the name error.) Go read the note -- it less then two pages. Honestly, go read it. It does not present a rule for programmers, so much as a call for language designers to provide control structures that are easy to reason about. If gotos are still needed, it suggests a lack of suitable alternatives. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2012-06-02 07:04 -0700 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <3d2daa57-0dfe-4562-a261-f143ff948001@googlegroups.com> |
| In reply to | #21643 |
בתאריך יום שבת, 2 ביוני 2012 03:46:45 UTC+1, מאת mike3: > > But I take it that, from what I've seen on this thread, using gotos to > jump to error code handlers is _not_ a "well-reasoned" use, right, and > so Djikstra's rules still apply? > Gotos for error handling ia a well reasoned use. Being able to give cogent reasons for doing something doesn't mean that it is right, or that someone else might be able to give even better reasons against. But it's rather different from the situation where an action is taken without consideration, or in ignorance of the problems that may be associated with it.
[toc] | [prev] | [next] | [standalone]
| From | "Aaron W. Hsu" <arcfide@sacrideo.us> |
|---|---|
| Date | 2012-06-02 04:37 -0500 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <KLCdnblHAZVzQ1TSnZ2dnUVZ_qmdnZ2d@giganews.com> |
| In reply to | #21640 |
On Sat, 02 Jun 2012 02:01:10 +0100, Ben Bacarisse wrote: > Both are models of clarity, and neither is dogmatic. I feel sure that > if all gotos in all programs had been as well-reasoned for as those in > Knuth's paper, Dijkstra would never have written his. Indeed, that is why I tend to refer people to the Knuth response after reading Dijkstra's original. Even today there is an unnecessary avoidance of GOTO, as if they are the root cause of all problems, when the problem both of the above authors really want to address is code that is not clear, reasoned, and justified. Spaghetti code should not exist, regardless of whether or not you use Gotos to write spaghetti code. -- Aaron W. Hsu | arcfide@sacrideo.us | http://www.sacrideo.us Programming is just another word for the lost art of thinking.
[toc] | [prev] | [next] | [standalone]
| From | mike3 <mike4ty4@yahoo.com> |
|---|---|
| Date | 2012-06-02 03:40 -0700 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <b8c63665-415d-4810-943d-b498baafff54@oo8g2000pbc.googlegroups.com> |
| In reply to | #21647 |
On Jun 2, 3:37 am, "Aaron W. Hsu" <arcf...@sacrideo.us> wrote: > On Sat, 02 Jun 2012 02:01:10 +0100, Ben Bacarisse wrote: > > Both are models of clarity, and neither is dogmatic. I feel sure that > > if all gotos in all programs had been as well-reasoned for as those in > > Knuth's paper, Dijkstra would never have written his. > > Indeed, that is why I tend to refer people to the Knuth response after > reading Dijkstra's original. Even today there is an unnecessary > avoidance of GOTO, as if they are the root cause of all problems, when > the problem both of the above authors really want to address is code that > is not clear, reasoned, and justified. Spaghetti code should not exist, > regardless of whether or not you use Gotos to write spaghetti code. > So does using GOTOs to jump to error handlers make the code less clear, reasoned, and justified (see the example in my OP)? How do they affect the clarity of the "real world program" code snippet I posted?
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2012-06-02 14:46 +0100 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <0.7236329ad4306dac295c.20120602150109BST.87vcj9ertm.fsf@bsb.me.uk> |
| In reply to | #21655 |
mike3 <mike4ty4@yahoo.com> writes: > On Jun 2, 3:37 am, "Aaron W. Hsu" <arcf...@sacrideo.us> wrote: >> On Sat, 02 Jun 2012 02:01:10 +0100, Ben Bacarisse wrote: >> > Both are models of clarity, and neither is dogmatic. I feel sure that >> > if all gotos in all programs had been as well-reasoned for as those in >> > Knuth's paper, Dijkstra would never have written his. It's been a while since I read it, so I read it again and I am no longer so sure. The surprising thing is that the note (it less then two pages long) is about go to in programming languages -- not in programs. In effect, it is a call to language designers to provide the right set of control structures so that go to's are no longer needed. Of course, the problem he so clearly identifies -- the fact that unbridled use of the go to (note: _unbridled use_) leads to code that can't be understood without maintaining a very complex view of the code's execution sate -- applies to code written in those languages that already have a go to statement. >> Indeed, that is why I tend to refer people to the Knuth response after >> reading Dijkstra's original. Even today there is an unnecessary >> avoidance of GOTO, as if they are the root cause of all problems, when >> the problem both of the above authors really want to address is code that >> is not clear, reasoned, and justified. Spaghetti code should not exist, >> regardless of whether or not you use Gotos to write spaghetti code. > > So does using GOTOs to jump to error handlers make the code less > clear, reasoned, and justified (see the example in my OP)? How do they > affect the clarity of the "real world program" code snippet I posted? To my mind, yes. However, the code is short and simple to re-write without goto, so it is neither a good example of what Dijkstra was arguing against, nor is it a good example of what Knuth was arguing to retain. Because it is short, it is not particularly hard to reason about (though it is harder to reason about than the goto-free version) and because the pattern is simple to re-write without goto, it not a case that shows the value of retaining goto in the language. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Date | 2012-06-02 17:10 +0100 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <jqde00$i9i$1@dont-email.me> |
| In reply to | #21679 |
"Ben Bacarisse" <ben.usenet@bsb.me.uk> wrote in message > To my mind, yes. However, the code is short and simple to re-write > without goto, so it is neither a good example of what Dijkstra was > arguing against, nor is it a good example of what Knuth was arguing to > retain. Because it is short, it is not particularly hard to reason > about (though it is harder to reason about than the goto-free version) > and because the pattern is simple to re-write without goto, it not a > case that shows the value of retaining goto in the language. The fact that C is quite often used a compilation target for other languages, is enough reason to retain the goto statement. (Even forgetting the millions of lines of existing code.) Any control statement that doesn't exactly match one of C's limited selection of statements, can easily be translated instead into a series of conditional statements and gotos. Then there might be housekeeping code, common return code, etc that doesn't fit into a structured programming pattern, as well as actual spaghetti code, using gotos, in the source language. (Actually, you can probably get rid of most control statements; just leave a simple if-statement (you don't need else), and goto. These are the most important.) While there might be theoretical ways of always being able to eliminate all gotos by convoluting the code and adding extra state variables, it's far easier just to use gotos. Especially in target code that no-one is ever going to read. But for actually writing in C, obviously you will use them sparingly. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2012-06-02 11:35 -0500 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <f5fks7dnpv44ql8i48m786ccv52hcsf0qp@4ax.com> |
| In reply to | #21679 |
On Sat, 02 Jun 2012 14:46:13 +0100, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: >mike3 <mike4ty4@yahoo.com> writes: > >> On Jun 2, 3:37 am, "Aaron W. Hsu" <arcf...@sacrideo.us> wrote: >>> On Sat, 02 Jun 2012 02:01:10 +0100, Ben Bacarisse wrote: >>> > Both are models of clarity, and neither is dogmatic. I feel sure that >>> > if all gotos in all programs had been as well-reasoned for as those in >>> > Knuth's paper, Dijkstra would never have written his. > >It's been a while since I read it, so I read it again and I am no longer >so sure. > >The surprising thing is that the note (it less then two pages long) is >about go to in programming languages -- not in programs. In effect, it >is a call to language designers to provide the right set of control >structures so that go to's are no longer needed. > >Of course, the problem he so clearly identifies -- the fact that >unbridled use of the go to (note: _unbridled use_) leads to code that >can't be understood without maintaining a very complex view of the >code's execution sate -- applies to code written in those languages that >already have a go to statement. > >>> Indeed, that is why I tend to refer people to the Knuth response after >>> reading Dijkstra's original. Even today there is an unnecessary >>> avoidance of GOTO, as if they are the root cause of all problems, when >>> the problem both of the above authors really want to address is code that >>> is not clear, reasoned, and justified. Spaghetti code should not exist, >>> regardless of whether or not you use Gotos to write spaghetti code. >> >> So does using GOTOs to jump to error handlers make the code less >> clear, reasoned, and justified (see the example in my OP)? How do they >> affect the clarity of the "real world program" code snippet I posted? > >To my mind, yes. However, the code is short and simple to re-write >without goto, so it is neither a good example of what Dijkstra was >arguing against, nor is it a good example of what Knuth was arguing to >retain. Because it is short, it is not particularly hard to reason >about (though it is harder to reason about than the goto-free version) >and because the pattern is simple to re-write without goto, it not a >case that shows the value of retaining goto in the language. I think that's an important point - the problems Dijkstra was referring to were in programs of multiple thousands of line of code with gotos jumping all around that entire program. More modern language, like C, which constrain gotos to a single function, greatly reduce the problem (the odd 5000 line function excluded, of course), because you simply cannot make that much spaghetti in a hundred (or two) lines of code. As always, locality is a major key to understanding. My personal opinion is that clarity trumps all. That being said, while I use gotos rarely, I have no problem with the error/cleanup/common-return pattern, an occasional break/continue out of more than one level of loop or other (very rare) uses where it's just simpler (some state machine like constructs, for example). All acknowledging that there are always alternatives, and many times, given that we shouldn't be writing excessively long functions, none of the alternatives is really that much more complex or unclear than the others.
[toc] | [prev] | [next] | [standalone]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Date | 2012-06-02 09:46 +0100 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <jqcjta$7mk$1@dont-email.me> |
| In reply to | #21611 |
"mike3" <mike4ty4@yahoo.com> wrote in message news:d4477aa8-f837-4bee-bb40-fbcc3da179c0@pr7g2000pbb.googlegroups.com... > On May 29, 11:44 pm, mike3 <mike4...@yahoo.com> wrote: > I've made an interesting and disturbing discovery. > > I found THIS: > YES, that's right -- those are GOTOs in there, and they do this a LOT > in this program! I've just looked at the Python source code. I counted around 2000 gotos in 200,000 lines of code. Mostly they seemed to be used in place of an early return, where there is common code to be executed before a return, so this is just written once at the end of a function. It seems clear enough. Some people don't like goto because it can lead to spaghetti code (eg. as used by io_x), but it doesn't need to. > Djikstra!!! I've no idea who you're talking about there... -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | "io_x" <a@b.c.invalid> |
|---|---|
| Date | 2012-06-03 10:43 +0200 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <4fcb2258$0$1375$4fafbaef@reader2.news.tin.it> |
| In reply to | #21646 |
"BartC" <bc@freeuk.com> ha scritto nel messaggio news:jqcjta$7mk$1@dont-email.me... > "mike3" <mike4ty4@yahoo.com> wrote in message > news:d4477aa8-f837-4bee-bb40-fbcc3da179c0@pr7g2000pbb.googlegroups.com... >> On May 29, 11:44 pm, mike3 <mike4...@yahoo.com> wrote: > >> I've made an interesting and disturbing discovery. >> >> I found THIS: > >> YES, that's right -- those are GOTOs in there, and they do this a LOT >> in this program! > > I've just looked at the Python source code. I counted around 2000 gotos in > 200,000 lines of code. Mostly they seemed to be used in place of an early > return, where there is common code to be executed before a return, so this is > just written once at the end of a function. > > It seems clear enough. Some people don't like goto because it can lead to > spaghetti code (eg. as used by io_x), but it doesn't need to. so you know what structured programming mean? >> Djikstra!!! so Djikstra know what structured programming mean? "structured programming" has something in common to write down in code the correct algo? if someone speak not good for goto he/she make wrong... he she don't know to what he she is talking about... it is good find a way to write easy one algo and find a way for find easily errors in that too but it need art > I've no idea who you're talking about there... > > -- > Bartc
[toc] | [prev] | [next] | [standalone]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Date | 2012-06-03 10:58 +0100 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <jqfcgt$i8m$1@dont-email.me> |
| In reply to | #21742 |
"io_x" <a@b.c.invalid> wrote in message news:4fcb2258$0$1375$4fafbaef@reader2.news.tin.it... > > "BartC" <bc@freeuk.com> ha scritto nel messaggio >> It seems clear enough. Some people don't like goto because it can lead to >> spaghetti code (eg. as used by io_x), but it doesn't need to. > > so you know what structured programming mean? Something like this I guess: http://en.wikipedia.org/wiki/Structured_programming > so Djikstra know what structured programming mean? > "structured programming" has something in common to write > down in code the correct algo? > > if someone speak not good for goto he/she make wrong... > he she don't know to what he she is talking about... It's not just black and white. You wouldn't use 'goto' to replace the if-else, while, do-while, switch and for statements, because the code would be much more obscure. But I can't see the problem in using it where no suitable control statement exists (although others would argue that it is better then to turn the code upside-down so that it does fit into the statements that are available). (I couldn't find a copy of Dijkstra's letter; there's an annotated version here, with his text in blue: http://david.tribble.com/text/goto.html) > it is good find a way to write easy one algo > and find a way for find easily errors in that too > but it need art It needs that you are the one who wrote the original code, and that you are reading the same code five minutes later. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | "io_x" <a@b.c.invalid> |
|---|---|
| Date | 2012-06-03 17:18 +0200 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <4fcb81da$0$1389$4fafbaef@reader1.news.tin.it> |
| In reply to | #21744 |
"BartC" <bc@freeuk.com> ha scritto nel messaggio news:jqfcgt$i8m$1@dont-email.me... >> it is good find a way to write easy one algo >> and find a way for find easily errors in that too >> but it need art > > It needs that you are the one who wrote the original code, and that you are > reading the same code five minutes later. i read my code only in case of bug...i think i could not read code from some other one... i don't know for debug-understand other code, but for my code i not have problem; can be years 1000 yesars etc etc... yes i not use much comment, for find one error i use the debug for find the 10-20 lines that generate the error; without understand the remain... than i debug these line for to see what dey do and what they do when error came out... and for this, there is some time because one has to understand all: why this, why that, etc until the error is found; until now, using above method i found all error i searched. these bugs came out one time 30-90 days or when i change the library functions etc for example the last one... some day ago i test if the new library goes well with the old program... but there was one error; i just track down all function changed from old-new dll but no step toward find the error... so i trace for find the function find for the first the error: it was one time function, the error is not in the new function but in the old ones in a time function that found "this day" the last day of the month, is not right... and so return error the error was that in time library the tables for days in month are wrong daytab db 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 daytabL db 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 instead of ; 1 2 3 4 5 6 7 8 9 10 11 12 daytab db 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 daytabL db 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 and the function return error because it find that the now day is not right i change the table and all ok... this error could no came out easily because came out only in the last day of the month if the month is the one right :) i think i like track down errors it is like read one book of Agatha Cristie...
[toc] | [prev] | [next] | [standalone]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Date | 2012-06-04 20:40 +0000 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <jqj6g8$a85$1@reader1.panix.com> |
| In reply to | #21744 |
In article <goto-20120603170542@ram.dialup.fu-berlin.de>, Stefan Ram <ram@zedat.fu-berlin.de> wrote: > The code alteration of the first paragraph seems to be > easier with structured blocks. It also might be easier to > read and to argue about properties of that code segment or > to prove them; the mere wording »precondition«, > »postcondition«, and »invariant« of a block seem to imply > that it is a structured block. What i see here is that the postcondition typically comprises two conditions, one for normal exit, one for error exit, and they are usually pretty dissimilar. So i'm not sure that insisting on one postcondition really buys you any simplicity. In terms of code, it's always nice to see the normal exit first, then the error handling. Someone who just wants to get some idea how a function works does not need to plow through the latter. Of course we want to be sure that it's right, but it's often just distracting.
[toc] | [prev] | [next] | [standalone]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Date | 2012-06-05 01:03 +0000 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <jqjltb$gcq$1@reader1.panix.com> |
| In reply to | #21830 |
In article <postconditions-20120605002952@ram.dialup.fu-berlin.de>,
Stefan Ram <ram@zedat.fu-berlin.de> wrote:
> It is not mentioned on
>
>http://en.wikipedia.org/wiki/Postcondition
?
'a postcondition is a condition or predicate that must always be true
just after the execution of some section of code'
e.g.
int foo(int x)
{
int y;
if (x == 0)
{
y = 0;
}
else
{
y = 1;
}
return y;
}
A precondition of the first block is "x == 0".
A precondition of the second block is "x != 0".
A postcondition of the first block is "x == 0 && y == 0".
A postcondition of the second block is "x != 0 && y != 0".
A postcondition of the if/else construct is
"x == 0 && y == 0 || x != 0 && y != 0".
[toc] | [prev] | [next] | [standalone]
| From | Joe Pfeiffer <pfeiffer@cs.nmsu.edu> |
|---|---|
| Date | 2012-06-04 21:36 -0600 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <1bzk8ibfaw.fsf@pfeifferfamily.net> |
| In reply to | #21847 |
ram@zedat.fu-berlin.de (Stefan Ram) writes: > jgk@panix.com (Joe keane) writes: >>A precondition of the first block is "x == 0". > > This is the /second/ compound statement. The /first/ > compound statement starts at the first brace in your code. > >>A postcondition of the first block is "x == 0 && y == 0". > > This is /one/ postcondition. Before, you wrote: > >>>>the postcondition typically comprises two conditions > ¯¯¯ > . There is no source that says so (except your post). I think he's talking about what he's seen in his experience, not a definition -- that he's tended to see postconditions of the form (a || b) where 'a' means "the postcondition you'd expect from a naive statement of the algorithm" and 'b' means "some strange kludge that came about as a result of an error in the course of executing the code".
[toc] | [prev] | [next] | [standalone]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Date | 2012-06-05 15:13 +0000 |
| Subject | Re: GOTOs discovered in "real world" program! |
| Message-ID | <jql7n3$m87$1@reader1.panix.com> |
| In reply to | #21853 |
In article <1bzk8ibfaw.fsf@pfeifferfamily.net>,
Joe Pfeiffer <pfeiffer@cs.nmsu.edu> wrote:
>I think he's talking about what he's seen in his experience, not a
>definition
I think i'm talking about what i've seen in my experience, not a
definition
>-- that he's tended to see postconditions of the form (a || b)
i tended to see all postconditions of the form
IF [error code is zero] THEN
all operations we did completed successfuly
go ahead with what you wanted to do
ELSE /* error code is not zero */
at least one thing we tried did not complete successfully
we tried to clean it up but we can not guarantee that
we tried to return the error code for the -first- error
if you fix the first error we can probably do a better job
at telling you what if anything else is wrong
ENDIF
>where 'a' means "the postcondition you'd expect from a naive statement
>of the algorithm" and 'b' means "some strange kludge that came about as
>a result of an error in the course of executing the code".
; handling 'double errors' you will never get -right-, but at least you can
try to be helpful.
[toc] | [prev] | [next] | [standalone]
| From | Ike Naar <ike@sverige.freeshell.org> |
|---|---|
| Date | 2012-06-05 08:12 +0000 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <slrn3vfsjsrfsa.4g9.ike@sverige.freeshell.org> |
| In reply to | #21847 |
On 2012-06-05, Stefan Ram <ram@zedat.fu-berlin.de> wrote: > jgk@panix.com (Joe keane) writes: >>A precondition of the first block is "x == 0". > > The /first/ > compound statement starts at the first brace in your code. A real quiche-eater would call that the zero-th compound statement ;-)
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2012-06-05 06:00 -0400 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <jqklbj$2if$1@dont-email.me> |
| In reply to | #21860 |
On 06/05/2012 04:12 AM, Ike Naar wrote: > On 2012-06-05, Stefan Ram <ram@zedat.fu-berlin.de> wrote: >> jgk@panix.com (Joe keane) writes: >>> A precondition of the first block is "x == 0". >> >> The /first/ >> compound statement starts at the first brace in your code. > > A real quiche-eater would call that the zero-th compound statement ;-) Such people really do exist; I once had a very confusing discussion with someone who insisted on misusing English that way. -- James Kuyper
[toc] | [prev] | [next] | [standalone]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Date | 2012-06-05 02:05 +0000 |
| Subject | Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) |
| Message-ID | <jqjphk$ajl$1@reader1.panix.com> |
| In reply to | #21830 |
In article <postconditions-20120605002952@ram.dialup.fu-berlin.de>,
Stefan Ram <ram@zedat.fu-berlin.de> wrote:
> and I am not aware of any source speaking of such /two/
> postconditions.
http://en.wikipedia.org/wiki/Hoare_triple#Conditional_rule
any language with an if/else construct has two postconditions
{B && P} S {Q}, {!B && P} T {Q}
----
{P} if B then S else T endif {Q}
or mine
{B && P} S {Q}, {!B && P} T {R}
----
{P} if B then S else T endif {Q || R}
identical since "Q" -> "Q || R", "R" -> "Q || R", "Q || Q" -> "Q" are
tautologies
[toc] | [prev] | [next] | [standalone]
Page 4 of 7 — ← Prev page 1 2 3 [4] 5 6 7 Next page →
Back to top | Article view | comp.lang.c
csiph-web