Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: down Message-ID: <701@auspex.UUCP> Date: 14 Dec 88 00:55:06 GMT References: <9142@smoke.BRL.MIL> <45472@yale-celray.yale.UUCP> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 20 >Doesn't the expression (c = getchar()) have type (int) regardless of the >type of c? Or will c being a char really prevent this comparison? From K&R Second Edition (based on some particular d of the dpANS); K&R First edition says much the same thing: A7.17 Assignment Expressions ...The type of an assignment expression is that of its left operand, and the value is the value stored in the left operand after the assignment has taken place. So no, the expression has the same type as "c", which is type "char", not "int", and it has the value that was stored in "c". If "getchar()" returned EOF, and EOF is -1 (as it is on most, if not all, UNIX implementations of C) on an 8-bit-byte two's complement machine the value '\377' is stored in "c". When the comparision with EOF is done, the "char" value of the expression is converted to "int"; if "char"s are unsigned, the '\377' is converted to 255, which is definitely not equal to -1 (EOF)....