M
Malcolm McLean
size_t is not just used for sizes of memory, it is also used to countPhilip Potter said:Can you give an example of the problem? I'm confused as to what your issue
is.
arrays. If it was used perfectly consistently then int would fade away,
because only a few integers are used as natural numbers, the vast majority
count or index things, or are used in intermediate calculations to derive
indexes. (This is true even for char, if you think about it, eventually it
is used to index into a character table for display to a human).
However size_t will not be used consistently for everything that counts or
indexes item in memory. People will still not infrequently use int. So the
result is a mishmash of integer types. So you end up writing little routines
to convert arrays of int to size_t s and back again, even though they are
all the same underlying bit representation, all because Fred wants a list of
ints and Jim a list of size_ts.