From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public From: dennison@telepath.com Subject: Re: Software landmines (was: Why C++ is successful) Date: 1998/08/17 Message-ID: <6r9f8h$jtm$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 381719379 References: <6qfhri$gs7$1@nnrp1.dejanews.com> <35cb8058.645630787@news.ne.mediaone.net> <902934874.2099.0.nnrp-10.c246a717@news.demon.co.uk> <6r1glm$bvh$1@nnrp1.dejanews.com> Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Aug 17 14:38:08 1998 GMT Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.0; Windows NT; Gateway2000) Date: 1998-08-17T00:00:00+00:00 List-Id: In article , dewar@merv.cs.nyu.edu (Robert Dewar) wrote: > T.E.D says > > But it's a toss up in this case, and for most purposes we would prefer > the second case. Where it gets tricky is > > for J in 1 .. N loop > if condition 1 then > ... > if condition 2 then > ... > if conditoin 3 then > goto Continue; > > Now T.E.D's prescription is not so clear, and we end up having to > severely contort things, or introduce a boolean flag which we keep > testing as we unwind to the end. > > Remember that the continue here is just like a return. If you are allergic > to using a loop continue or exit, you should be allergic to using a return > (other than at the end of a function). Some people are, and that is at > least consistent. But I see a lot of Ada programmers who will use a return > without hesitation from a nested loop, but still turn green at the sight > of a goto. That makes no sense to me. > Good point. Typically in this case I would "cheat" it and embed the inside of the loop in a subprogram, with a return statement. You think that's no better than using a "goto". I think it IS better, because the rule for where control goes to after a return statement is much clearer than for goto. For the return, I just start reading code after the subprogram call. For goto, I have to search the entire source for the label that is being jumped to. Just as importantly, someone can completely change my structure just by moving that label. But yes, we are probably talking Bordeaux vs. Mad Dog 20-20. > So the "average" poor maintainer schlep looks at this and thinks > "is this just a continue, or a complete restarting of the loop?" > Oh yeah, that's clear. %-( > > On the other hand, I see no reason to accept this rhetoric, if indeed > you do have these poor maintainer shleps looking at the code, we have > only T.E.D.'s unsupported allegation that they will have more trouble > with my form than some other form (note that, perhaps wisely, T.E.D > does not attempt to demonstrate the beautifully clear, alternative, > goto-free form -- enough other competent people have tripped on that > already :-) Why take my word for it? The very fact that "other competent people have tripped on that" proves how obtuse it is. You'd be quite lucky to have a maintanence staff as good as the folks here on c.l.*, and *they* can't even make a simple change to your code without completely screwing it up. I couldn't hope to come up with a better example. T.E.D. -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum