tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: setsockopt() compat issue



In message <200810200217.WAA20358%Sparkle.Rodents-Montreal.ORG@localhost>, der 
Mouse writ
es:
>Not, I think, if it supports stdio, because EOF has to be distinct from
>all possible unsigned chars.

I'm not sure it does.  EOF is a negative integer.  Usually, that would mean
that EOF is outside the range of unsigned char.  However, if unsigned char
is the same width as int, then the situation is reversed; many unsigned char
values get converted when used as ints.  In this case, it is not possible
to tell whether EOF is a magic sentinel value or not.  However, it is possible
to check, upon receiving a value comparing equal to EOF, whether feof() or
ferror() is true.

I can't see anything in the standard which actually requires int to be larger
than char.

-s


Home | Main Index | Thread Index | Old Index