Does in glibc, the sizeof(ssize_t) always equals to sizeof(size_t)
Yonggang Luo
luoyonggang@gmail.com
Sat May 23 13:12:20 GMT 2026
On Sat, May 23, 2026 at 1:58 AM Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> On 2026-05-22 10:50, Yonggang Luo wrote:
> > Do you mean (OSF/1, UNICOS, late old AmigaOS/AROS/MorphOS, old TRON) ,
> > these lists of OS have sizeof(ssize_t)!=sizeof(size_t)?
>
> Yes, that's what I meant. They all had ssize_t narrower than size_t.
> This was for backward compatibility, e.g., their 'read' syscall always
> returned a 32-bit signed int even though size_t was 64 bits. In some of
oh the syscall(NOT POSIX) is returning a 32-bit signed int, we can use a
64-bit signed int to store it without loss.
So for these old systems, restrict sizeof(ssize_t) == sizeof(size_t) won't
hurt them.
Indeed, we already do something similar for time_t, the old time_t is 32bit
size, now the new POSIX specifications restrict the minimal size of
time_t to be 64-bit.
> the really-old systems the issue was 16-bit signed int vs 32-bit size_t.
>
> Perhaps this could happen in the future with 64-bit ssize_t and 128-bit
> size_t, right? Though that would be pretty far in the future.
>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260523/ae8001ec/attachment.htm>
More information about the Libc-alpha
mailing list