Bruno Haible <br...@clisp.org> writes:

> Hi Simon,
>
>> I'm not sure I understand why idx_t is better than size_t
>> here, can you elaborate?  Why not ssize_t?
>
> You find a detailed explanation in the comments of idx.h.

Thanks for the pointer -- it doesn't say anything about why ssize_t
can't be used though?  As a signed variant of size_t, it seems relevant
to consider.

>> Maybe a compromise is to
>> keep the old API but add new APIs with idx_t types and the
>> implementation of the old functions uses the new one.
>
> The objective is to eliminate bugs due to the use of unsigned types
> for numerical values.

Is that a realistic goal with C using the unsigned type size_t for
low-level functions like strlen()?  It seems like an un-idiomatic goal.

> We can achieve it only by increasing the use of signed types such as
> 'idx_t'. If we keep the old function, it needs to be marked with
> __attribute__ ((__deprecated__)), otherwise existing code will
> continue to use the old function forever.

My idea was that both APIs would be supported indefinitely.

/Simon

Attachment: signature.asc
Description: PGP signature

Reply via email to