This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: glibc at the Toolchains microconference at LPC 2019
- From: Florian Weimer <fweimer at redhat dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: Maciej Rozycki <macro at wdc dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 19 Jul 2019 13:49:26 +0200
- Subject: Re: glibc at the Toolchains microconference at LPC 2019
- References: <87o92kibdz.fsf@oldenburg2.str.redhat.com> <alpine.DEB.2.20.1906271839080.11773@tpp.hgst.com> <87y318r8eb.fsf@oldenburg2.str.redhat.com> <ca7b4e82-38b6-399f-2858-289ea4143588@cs.ucla.edu>
* Paul Eggert:
> Florian Weimer wrote:
>> When it comes to exposes the system call, we prefer to use size_t for
>> buffer sizes (even if the kernel uses int or unsigned int), purely for
>> documentation purposes.
>
> I suggest using "ssize_t or size_t" to keep the text parallel with
> "int or unsigned int". We shouldn't insist on size_t for buffer sizes
> when the natural interpretation of the value is signed (as in the
> return value for 'read' etc.) or is too large for malloc etc.
Right. Incoming buffer sizes should be size_t (no in-band signaling).
Return values tend to have in-band signaling for errors and thus need to
be ssize_t.
Thanks,
Florian