[OT] [sdiy] IN your mind, what is ....

Forbes, William - EE - UK/Leamington william.forbes at luk-asg.com
Wed Feb 4 09:59:28 CET 2004


'continue' and 'break' (except in a switch statement) are effectively
goto's!
The all cause a jump and the effects on maintainability can be just a severe
as a goto!
Why work round a 'goto' when a 'goto' is the most sensible thing to use?

Cheers,
Bill Forbes.

> -----Original Message-----
> From: Michael E. Caloroso [mailto:analoguediehard at att.net] 
> Sent: 04 February 2004 03:13
> Cc: synth-diy at dropmix.xs4all.nl
> Subject: Re: [OT] [sdiy] IN your mind, what is ....
> 
> 
> Shokwave wrote:
> > 
> > This reminds me of goto's in C. I make a point of showing 
> my students 
> > some of my code that contains a line like:
> > 
> > if(stuff_happened) goto error;
> > 
> > ...nestled at the center of a deeply nested loop. They 
> always look at 
> > each other, and gingerly one will raise a hand and say "but other 
> > instructors told us to never use a goto", and I grin 
> peacefully like 
> > Buddha and say "Yes, *you* shouldn't...unless you know you 
> should. Try 
> > and write that code without one, and show me a CLEARER way to do it.
> 
> (loopx (condition) substituted for, do, while, etc)
> 
> error=0;
> loop1 (condition1 & !error)
> {
>    loop2 (condition2 & !error)
>    {
>    ...code
> 
>      if (fubar) error=1; /* all loops exit when returned to top */
>      if (error) continue; /* aborts rest of loop2 */
> 
>    ...code
> 
>    } /* end loop2 */
> 
>    if (error) continue; /* aborts rest of loop1 */
> 
> } /* end loop1 */
> 
> There is ALWAYS a way around goto statements.  Not a simpler 
> solution, 
> but it keeps the pointer stack clean which is a goto cannot do.
> 
> I design code to run 24/7.  goto statements are forbidden in my work.
> 
> MC
> 



More information about the Synth-diy mailing list