On 10/08/2014 12:00 AM, Clive D.W. Feather wrote:
the view of WG14 was always that the representations of types stuff added in C99 was intended to have always applied to C90
Thanks, that's good to know if we run into this issue again in the future.
I can see that POSIX says "The type ssize_t shall be capable of storing values at least in the range [-1, {SSIZE_MAX}].", but that doesn't exempt it from the C rules concerning types.
Well, in *theory* ssize_t could be an extended integer type using one's complement and SSIZE_MAX could be 1, no? As far as I can tell nothing in the C standard prohibits that, and that would mean one couldn't necessarily store -2 into an ssize_t variable. Of course this is purely a theoretical objection, but I've always been suspicious of that POSIX rule about -1 and ssize_t -- the rule must be there for a reason, though they don't explain the reason -- and so prefer to avoid ssize_t except to hold the result of 'read'-like syscalls that are defined to return ssize_t.