This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: glibc at the Toolchains microconference at LPC 2019


* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]