Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!linus!vaxine!wjh12!genrad!decvax!cca!ima!ism780!paul
From: paul@ism780.UUCP
Newsgroups: net.unix-wizards
Subject: Re: Re: getc() != EOF - (nf)
Message-ID: <223@ism780.UUCP>
Date: Wed, 6-Jun-84 00:09:17 EDT
Article-I.D.: ism780.223
Posted: Wed Jun  6 00:09:17 1984
Date-Received: Fri, 8-Jun-84 01:31:11 EDT
Lines: 22

#R:rlgvax:-194900:ism780:14400009:000:632
ism780!paul    Jun  4 17:21:00 1984

[Nothing happens till it happens twice.]

All the comments I have seen here on

#define EOF (-1)
      char c;
      while ( (c = getc()) != EOF )

ignore one possibility:
if chars are signed and the file being read contains a byte equal to -1,
the loop will terminate BEFORE the end-of-file is reached!  If, that is,
the compiler implements assignment expressions correctly.  The VAX System III
compiler, for one, gets it wrong.

Paul Perkins
...{uscvax|ucla-vax|vortex}!ism780!paul
...decvax!yale-co!ima!ism780!paul
"Any opinions expressed in this message are not necessarily those of any
real person, organization, or computer."