Article View: comp.std.c
Article #3380Re: How to eliminate GOTO?
From: Rich Miller
Date: Sat, 26 Aug 1995 16:27
Date: Sat, 26 Aug 1995 16:27
27 lines
1701 bytes
1701 bytes
In article <41l688$csv@wormhole.cognos.com>, Mark Ingram <ingramm@Cognos.COM> wrote re a proposal for a "leave" statement: > >I recall a language very similar to C in which it was possible to >label blocks, and break optionally took such a label. Except it >was "quit", not "break". Also there was a combined if()quit structure >which was called "quif". I have used an interpreted database language with supported the syntax (roughly): break [number of levels] [and execute this code as if it occurs directly after the (multilevel) break happens It's a powerful feature -- but I doubt that its power justifies the cost of the associated complexity. Breaking out of a doubly-nexted loop (which is what this whole thread is about) is clearly best solved with a goto, according to such authorities as Dijkstra (author of the letter "GOTO Statement Considered Harmful" which started this whole goto debate) and Donald Knuth (see "Literate Programming", in which he discusses just this example). On the other hand, this thread *is* lending support to Dijkstra's claim that programmers, and especially students, are not able to determine how to use goto *correctly* :-). -- Rich Miller (rmiller@wolfenet.com)
Technical Details
Message-ID:
<41ni1c$ft6@news1.wolfe.net>Path:
arc1-ca.pugleaf.net!ratty.wolfe.net!rmillerReferences:
<41cke4$gtd@sparcserver.lrz-muenchen.de> <41iebe$kec@news0.rain.rg.net> <1995Aug25.114323.2982@lorelei.approve.se> <41l688$csv@wormhole.cognos.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ratty.wolfe.net!rmiller From: rmiller@Wolfe.NET (Rich Miller) Newsgroups: comp.std.c,comp.lang.c Subject: Re: How to eliminate GOTO? Date: 26 Aug 1995 16:27:24 GMT Organization: Wolfe Internet Access, L.L.C. Message-ID: <41ni1c$ft6@news1.wolfe.net> References: <41cke4$gtd@sparcserver.lrz-muenchen.de> <41iebe$kec@news0.rain.rg.net> <1995Aug25.114323.2982@lorelei.approve.se> <41l688$csv@wormhole.cognos.com> NNTP-Posting-Host: gonzo.wolfe.net