On Wed, 31 Aug 2005 14:21:05 GMT, Howard Hinnant
<> wrote:
>In article <>,
> Lilith <> wrote:
>
>> set pointers
>> copy attribute
>> check for termination
>> if terminated, break
>> set pointers
[snip]
>I just can't leave this one alone...
>I don't have enough information to truly guide you well. Your own
>suggestion later sounds promising to me:
>> I could make the whole piece
>> of code a function and escape out with a return
>That being said, I've seen code before that was especially convoluted
>just for the purpose of avoiding the goto keyword. This is a Bad Thing
>(tm).
>goto is your friend. Use it wisely. Use it sparingly. Use it when it
>is the best tool for the job. Do not abuse it. And most importantly of
>all in today's climate: Don't gratuitously complicate your code just to
>avoid typing those overly maligned 4 letters g-o-t-o.
>But be prepared: Middle level programmers will snicker at you for being
>so backwards as to use a goto in your code. After all, everyone who's
>anyone knows that goto is evil and should never be used. "Modern"
>languages don't even bother with it. Listen to their advice. If they
>can show you a way to code without using goto that is more readable, not
>larger code size, and not more expensive at run time, then they are
>right. If they can't, then snickering alone is not enough reason to
>remove a goto. As your programming skill advances (and it will if you
>keep considering the advice of your peers), you'll find that you are
>hardly ever tempted to use goto. But when you are, it is the perfect
>tool for the job - and you'll be able to defend its use to anyone who
>may snicker.
When I started programming (a personal pleasure, not a career) I
expected to program mostly in BASIC but found more enjoyment in
assembler for the 8080/Z80 CPU. Not lots of choices WRT goto there.
My hobby led to being put in charge of the new computer department of
the small tooling distributor I was working for at the time. I
modified program in a language called CPL 5 (I think there's another,
more common, language called CPL) that could only do gotos and gosubs
on conditions. There wasn't any kind of basic looping available so my
only option was spaghetti code.
With CPL 6 they added some rudimentary FOR and WHILE statements and I,
for the first time, began to use them extensively. In my opinion they
greatly helped me keep my code neat and it also helped with
development. I've avoided the goto since that day. At that time I
read lots of articles on programming technique and tried to adjust my
methods based on any number of "authoritative" pronouncements. Some
of them I agree with others I had problems with.
AAR, if I'd had any input in the design of C/C++ I would have liked to
have seen a break statement that would essentially escape the local
set of enclosing parentheses, regardless if it was in a loop or a set
of code to be skipped over.
>-Howard
>(who has been snickered at more than once for using goto)
--
Lilith (who won't snidker at her betters)