Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!umich!sharkey!tygra!dave From: dave@tygra.ddmi.com (David Conrad) Newsgroups: comp.lang.pascal Subject: Re: IMPLEMENT GOTO ACROSS MODULES IN TURBO PASCAL?? Summary: GOTO Considered Harmful Message-ID: <1991Jan9.093732.25047@tygra.ddmi.com> Date: 9 Jan 91 09:37:32 GMT References: <11656@j.cc.purdue.edu> <7147@tekgen.BV.TEK.COM> <11661@j.cc.purdue.edu> Organization: Moore Software, Detroit, MI Lines: 47 In article <11661@j.cc.purdue.edu> zhou@brazil.psych.purdue.edu (Albert Zhou) writes: > >This reminds me of the suggestion made by some researchers to eliminate goto's >altogether. Personally, I don't promote using goto's even within a block. >Instead of using: > > repeat > s1; > s2; > if c then goto out; > s3; > until forever; > out:; > >I use: > repeat > s1; > s2; > s3; > until c; > >However, in rare cases, s3 can be very time-consuming and by using the first >code, one can save the time to execute s3 when c is true. > You could just use: repeat s1; s2; if not c then s3; until c; I've often seen it stated that there are situations where goto's are unavoidable, but I've never seen an instance of such a situation. Even finite state machines can be implemented by case statements, although if the case statements evaluate to nested if's instead of a jump table then I can see where one would rather use goto's to emulate the jump table. Or, with procedural types (call by name), you could actually code a jump table in an array. -- David R. Conrad dave@tygra.ddmi.com -- = CAT-TALK Conferencing Network, Computer Conferencing and File Archive = - 1-313-343-0800, 300/1200/2400/9600 baud, 8/N/1. New users use 'new' - = as a login id. AVAILABLE VIA PC-PURSUIT!!! (City code "MIDET") = E-MAIL Address: dave@DDMI.COM