bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modules xsize and idx


From: Paul Eggert
Subject: Re: Modules xsize and idx
Date: Wed, 7 Apr 2021 11:28:27 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 4/7/21 4:00 AM, Marc Nieper-Wißkirchen wrote:

That's why I am wondering whether it makes sense to have an xsize module
that uses idx_t instead of size_t.

It might, yes. I use intprops.h for this sort of thing, but perhaps a stripped-down header would be appropriate.

I am planning to make xalloc.h use idx_t rather than size_t for object and byte counts, as we really should be using signed integers there, for all the usual reasons. So in some sense I want xsize's current API to be obsolete.

   assure (i < n);
   assure (0 <= i);

I suggest writing 'assure (0 <= i && i < n);' as it's easier to read, at least for me. Better yet, use 'affirm' rather than 'assure' as this helps the compiler generate better code.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]