Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.misc Subject: Re: The "evil" GOTO (Was: 25 Years of BASIC) Message-ID: <939@twwells.uucp> Date: 23 May 89 02:35:51 GMT References: <1791@ubu.warwick.UUCP> <1436@onion.reading.ac.uk> <1814@ubu.warwick.UUCP> <698@occrsh.ATT.COM> <852@umecs.cs.umu.se> <912@twwells.uucp> <1826@wasatch.utah.edu> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 41 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <1826@wasatch.utah.edu> cetron@wasatch.utah.edu (Edward J Cetron) writes: : In article <912@twwells.uucp> bill@twwells.UUCP (T. William Wells) writes: : >And if one insists on not putting this into its own function (making : >the return improper): : > : > for (i = 0; i < N; ++i) { : > for (j = 0; X[i][j] == 0; ) { : > if (++j == N) { : > printf("The first all-zero row is %d\n", i); : > break; : > } : > } : > if (j == N) { : > break; : > } : > } : > : >One could, of course, turn the first break into a goto, but : >eliminating the possible cost of the j == n test isn't worth the loss : >of clarity. : : AHA! But what if it WAS a function? And what if it was some sort of very : heavily used function? In THAT case wouldn't that fact that you saved : that extra useless code be worth something? Are you brain-dead? Or just blind? (Like me?) This is also from the article you quoted: for (i = 0; i < N; ++i) { for (j = 0; X[i][j] == 0; ) { if (++j == N) { printf("The first all-zero row is %d\n", i); return; } } } And is perfectly appropriate for putting into a function. --- Bill { uunet | novavax } !twwells!bill