"Schwarz, Konrad" <[EMAIL PROTECTED]> writes:

> What is the justification for making the return value of read() have type
> ssize_t?

Again, I wasn't there.  But when ssize_t was invented, C89 (and
therefore ptrdiff_t) was not required by POSIX, so I expect the
original motivation was that POSIX wanted a type and could not assume
ptrdiff_t (and couldn't define ptrdiff_t either, due to potential
clashes).

Nowadays it's conventional wisdom that ssize_t must be the same width
as size_t, and I expect that code relies on this even if POSIX doesn't
require it.  It's not conventional wisdom that ptrdiff_t must be the
same width as size_t, because implementations may want ptrdiff_t to be
reliable, and in general ptrdiff_t is not reliable unless it's wider
than size_t.  So there's still a gap between the two types in
principle, not that I know of any modern implementation where they
actually differ.


Reply via email to