|
From: | Paul Eggert |
Subject: | Re: [PATCH 5/6] canonicalize: prefer signed integer types |
Date: | Thu, 3 Dec 2020 11:34:33 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 |
On 12/2/20 3:56 PM, Bruno Haible wrote:
can we have typedef names for these signed types that are supposed to only have values >= 0 ?
More generally, when I'm reviewing code I naturally look for relationships like 0 <= i < j < n. I can see where one might want to say "j is of type i+1 .. n-1" but all things considered it'd be better for the compiler and/or human reader to infer that sort of thing, than to clutter the code with something like "int __attribute__ ((range (i+1 .. n-1))) j;" when declaring j. Of course "idx_t j;" is much less clutter than the __attribute__ stuff but it's not clear that it's worth the bother to have yet another integer type for this sort of thing.
[Prev in Thread] | Current Thread | [Next in Thread] |