Follow-up Comment #8, bug #68812 (group groff):

[comment #7 comment #7:]
>> the problem is not that using the data type "int" for array
>> indices is wrong in any way
> 
> Of course it is.  `int` is always signed, and negative indexing
> from the _start_ of an array object is always UB, as I understand it.

That doesn't mean the type is wrong; it means the type can hold values that
are not useful for array indexing.  But this is almost always the case for
arrays anyway: if an array has 12 elements, _any_ data type for the index will
contain values invalid for that array.  It remains the responsibility of the
code accessing the array to use only valid array indices.  The data type of
the index cannot help in this task, except in very limited circumstances
(e.g., an array with exactly 256 elements).


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68812>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to