Xref: utzoo misc.misc:5960 comp.misc:5961 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!oliveb!cygnet!mark From: mark@cygnet.CYGNETSYSTEMS (Mark Quattrocchi) Newsgroups: misc.misc,comp.misc Subject: Re: The "evil" GOTO (Was: 25 Years of BASIC) Keywords: Guinness, phlegm, mackerel, intestines Message-ID: <1384@cygnet.CYGNETSYSTEMS> Date: 5 May 89 22:08:28 GMT References: <1791@ubu.warwick.UUCP> <1436@onion.reading.ac.uk> <1814@ubu.warwick.UUCP> <11136@bloom-beacon.MIT.EDU> <24047@agate.BERKELEY.EDU> Reply-To: mark@cygnet.UUCP (Mark Quattrocchi) Organization: Cygnet Systems -- Sunnyvale, California Lines: 32 In article <24047@agate.BERKELEY.EDU> ked@garnet.berkeley.edu (Earl H. Kinmonth) writes: >>Indeed, this is a pretty bad example of where a goto would be useful, >>because you are simply illustrating what the purpose of the C do ... >>while construct is for: >> >>do { >> fprintf(stdout, "Enter your sex ( or only): "); >> fflush(stdout); >> fgets(stdin, sex, 2); >> fflush(stdin); >>} while ((*sex != 'm') && (*sex != 'f')); > >First, your C compiler must have a rather weird stdio library if it >requires you to to do explicit flushing. > >Second, why not > > while(1) { > fputs("Sex (m or f) ",stdout); > gets(ls); > if(ls[0] == 'm') return(ls[0]); > else > if(ls[0] == 'f') return(ls[0]); > } > >as a subroutine? This is great! Now we have two incorrect versions. Open eyes, read original, duplicate. I suppose they did this because the program would be twice as long if they made it compatible with the original. Sorry, just testing our newsfeed (yeah that's it).