Re: [PATCH 1/2] system_data_types.7: Document size_t

Alejandro Colomar
2020-09-18T15:53:19Z

Hello Florian,

On 2020-09-18 16:34, Florian Weimer wrote:
> * Alejandro Colomar via Libc-alpha:
>
>> +Used for a count of bytes. It is the result of the
>> +.I sizeof
>> +operator.
>> +According to the C language standard,
>> +it shall be an unsigned integer type
>> +capable of storing values in the range [0,
>> +.BR SIZE_MAX ].
>
> Thanks for working on this.

:-)

> Maybe add that this commonly maps to unsigned int or unsigned long, and

I thought the same in the beginning,
but then Michael convinced me to not do it.

On 2020-09-13 22:20, Michael Kerrisk (man-pages) wrote:
>>>> Is it a 32-bit or 64-bit or may vary? Is it signed or unsigned?
>>> POSIX doesn't specify, I think.>
>>> One other thing the page should show of course is definition of the
>>> structure types.
>> Yes.
>>
>>
>> timer_t <time.h> or <sys/types.h>
>> POSIX timer ID.
>>
>> typedef void *timer_t;
> Here I would *not* show these kinds of typedefs. The point is
> that these types should be treated as being somewhat unknown
> (e.g., for casts in printf()). Here, I think instead maybe we
> just have a statement that POSIX makes no specific requirements
> for the representation of this type.

I think I prefer to leave it opaque, showing only the requirements
that POSIX and C make.

There's really not much gain (basically uint and ulong cover most of the
possibilities; and still it's not a guarantee).
And readers might write non-portable code because of reading that.

On 2020-09-18 16:34, Florian Weimer wrote:
> that the length modifier for printf and scanf is z, commently used as
> %zu or %zx (%zd is for ssize_t).

Good idea.

Would you prefer that, or just refer to printf(3) in See also?.

>
> Florian
>

Thanks,

Alex