bug-gnulib
[Top][All Lists]
Advanced

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

Re: Make more use of idx_t


From: Paul Eggert
Subject: Re: Make more use of idx_t
Date: Thu, 17 Dec 2020 01:52:51 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

On 12/6/20 3:32 AM, Bruno Haible wrote:
Paul Eggert wrote:
Those all look good to me.

OK, I pushed them.

When I looked into this a bit more when hacking on canonicalize-lgpl, I realized I spoke too soon. First, there's some cruft left over from when idx_t could be unsigned. More important, defining IDX_WIDTH to be PTRDIFF_WIDTH - 1 is confusing as this makes idx_t different from all other signed types in that IDX_WIDTH does not count the sign bit. I can see why it doesn't count the sign bit (the sign bit is always zero) but I can also see why it should (shift counts are limited by the *_WIDTH macros). If we're going to have a macro that stands for PTRDIFF_WIDTH - 1 it'd probably be better to use a different naming convention, to avoid that confusion. However, nobody's using any such macro now and possibly we'll never need it so in the meantime I merely substituted a comment for the #define in the attached patch.

Hope this is OK; further comments welcome of course.

Attachment: 0001-idx-simplify-IDX_MAX-remove-IDX_WIDTH.patch
Description: Text Data


reply via email to

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