4 ms·
Because of EOF being -1
by radiospiel 5y ago
Because of EOF being -1
- Someone 5y agoNitpick: it is only guaranteed to be unequal to any character and less than zero. (And no, I don’t know any implementation that has it unequal to minus one. I would love to see a devilish C compiler/standard library that would make all kind of standard-conforming, yet non-standard implementation choices (EOF not minus one, RAND_MAX a fairly small prime, etc. Goal would be to have no single major program run correctly on it)
- CamperBob2 5y agoGood point, but if the standard defines EOF as a negative value while at the same time permitting implementations to support default-unsigned char types, then the sanity train obviously left the tracks at that time, or at some time prior to it.