TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jerry Coffin
from: Jasen Betts
date: 2003-11-18 06:09:44
subject: Re: [C] word sizes

JC> There is one proviso to that: though never says so explicitly, for
 JC> I/O to work correctly (specifically for EOF to be unique from any
 JC> input that could have been read from the file) the range of int
 JC> has to be greater than (not equal to) the range for char.

This  rarely happens.  often EOF is defined as -1  and when char is signed
the two overlap regardless of the size of the two quantities.

if you see EOF in an input char you should check the stream (or fh) explicitly.
using feof() (or eof())

 JC> IOW, if there are 64 bits in the value representation of a char, then
 JC> there had better be at least 65 bits in an int, or the I/O model no
 JC> longer works

that doesn't work with dos where char is 8 and int 16 (or 32)

  -=> Bye <=-

---
* Origin: One less than the checksum of "Jasen Betts" (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.