Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!mips!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers From: kers@hplb.hpl.hp.com (Chris Dollin) Newsgroups: comp.lang.c Subject: Re: Trouble at EOF Message-ID: Date: 17 Jun 91 09:07:21 GMT References: <12847@pucc.Princeton.EDU> Sender: news@hplb.hpl.hp.com (Usenet News Administrator) Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 20 In-Reply-To: EGNILGES@pucc.Princeton.EDU's message of 16 Jun 91 17:04:35 GMT Nntp-Posting-Host: cdollin.hpl.hp.com Ed Nilges says (about fgets and the optional newline): be the Edge of the World, but this seems a tad bogus, especially if one is writing a lexical analyser where such issues are important. If I was writing a lexical analyser in C, I certainly would not first read in the entire line, not even with fgets; I'd read in characters as required. (How big a biffer should I allocate for fgets? What do I do on line overflow? These are questions I wish to unask.) Is the overhead of reading characters with fgetc really so large? (I suppose if the lexis is suitable bizarre, you may need lots of putback, and being able to just backbump the line index is easy. I find it a crying shame that stdio doesn't mandate arbitrary putback. Still, it's not as bad as Lisp - at least C has an excuse.) -- Regards, Chris ``GC's should take less than 0.1 second'' Dollin.