On 12/3/20 6:25 AM, Bruno Haible wrote:
/* The user can define UNSIGNED_INDSIZE_T, to get a different set of compiler warnings. */
I'm leery of this complexity, as it would change the semantics of what the type means. The type is not just about compiler warnings; it's about preferring signed integer arithmetic whenever possible to avoid unexpected results during comparisons and to catch integer overflow.
typedef ptrdiff_t indsize_t;
The type name "indsize_t" is a bit long and this would detract from readability in programs that use a lot of indexes. I suggest "idx_t" instead. dfa.c is already using this type name and it works well there.
dfa.c also has IDX_MAX. I suppose IDX_WIDTH would also be useful. I'm not so sure about PRIdIDX etc. as those macros make programs hard to read and I don't see much point to hiding the fact that the type is equivalent to ptrdiff_t. (dfa.c just uses %td etc. for printf formats.)