Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: misc.misc,comp.misc Subject: Re: The "evil" GOTO (Was: 25 Years of BASIC) Keywords: Guinness, phlegm, mackerel, intestines Message-ID: <11197@bloom-beacon.MIT.EDU> Date: 7 May 89 23:32:53 GMT References: <1791@ubu.warwick.UUCP> <1436@onion.reading.ac.uk> <1814@ubu.warwick.UUCP> <11136@bloom-beacon.MIT.EDU> <24047@agate.BERKELEY.EDU> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 33 Xref: utzoo misc.misc:5996 comp.misc:5993 In article <24047@agate.BERKELEY.EDU> ked@garnet.berkeley.edu (Earl H. Kinmonth) writes: >First, your C compiler must have a rather weird stdio library if it >requires you to to do explicit flushing. Some stdio libraries do not flush stdout unless you print a newline, and when you are prompting for input you usually do not follow the prompt with a newline. Further, I flushed stdin because I wanted to be consistent :-) -- it probably wan't necessary. >Second, why not > > ... > >as a subroutine? My point was not that the code segment I posted was the *best* way to do the job, but rather that it was one way to do it that did not require goto's. You have shown another way. As for why not as a subroutine, if you're only doing it once then using a subroutine is a speed hit that you don't need (a small speed hit, granted, but a speed hit nevertheless :-). Inlining makes it run faster. You're suggestion is similar to the suggestion someone else posted of using break to exit the loop when valid input was obtained. Jonathan Kamens USnail: MIT Project Athena 410 Memorial Drive, No. 223F jik@Athena.MIT.EDU Cambridge, MA 02139-4318 Office: 617-253-4261 Home: 617-225-8218