Xref: utzoo misc.misc:6054 comp.misc:6035 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!hc!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: misc.misc,comp.misc Subject: Re: Re^2: The "evil" GOTO (Was: 25 Years of BASIC) Message-ID: <13366@lanl.gov> Date: 9 May 89 22:52:47 GMT References: <2468@solo9.cs.vu.nl> Organization: Los Alamos National Laboratory Lines: 42 From article <2468@solo9.cs.vu.nl>, by roemer@cs.vu.nl (Roemer Lievaart): > In article <13113@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >> if (cond1) { >> [...A...] /* lots of code */ >> goto LABEL;} >> else if (cond2) { >> LABEL: [...B...] /* lots more code */ >> } >> > > Ugh. I would choke on this several times if I would have to maintain this. > [...] > BTW. Why not: > > if (cond1 || cond2) { > if (cond1) { > [...A...] > } > [...B...] > } Bletch!! This is worse than implementing B as a procedure. I duplicates the evaluation of the condition. It doesn't generalize well at all: if (cond1) { [...A...] /* lots of code */ goto LABEL;} else if (cond1_prime) { [...A_prime...] /* lots of code */ goto LABEL;} [...] else if (cond1_nprime) { [...A_nprime...] /* lots of code */ goto LABEL;} else if (cond2) { LABEL: [...B...] /* lots more code */ } By your method, the duplicated condition evaluation would be _very_ long and difficult to read.