M
Malcolm
char is for character data. Admittedly it has been overloaded to representKeith Thompson said:Malcolm said:Due to this size_t nonsense integers are no longer ints, which isKeith Thompson said:To overcome this,
is an implementation allowed to cast array indexes to long long?
(This, of course, is why the "best" type for array indexing is
generally size_t, or a signed variant of size_t: size_t can [and
should] be "unsigned long long" on implementations with memory
sizes exceeding UINT_MAX.)
If there is a problem using an integer to index an array, in this
case that array sizes can go beyond the range, then really the
implementation needs to be fixed, or the standard.
You said "integer". Did you mean "int"?
the heart of the problem.
I don't see that it's a problem.
If you want a language in which "int" is the only integer type,
C is not that language, and I don't believe it ever has been.
The earliest C reference manual I can find, which predates K&R1,
has both char (8 bits) and int (16 bits).
bytes for where you need direct control of bits in memory, which was a
mistake.
short and long are concessions to machine efficiency, relucantly allowed and
only for special use. Rarely you need integers of a special length.
size_t is an integer designed bya committee, an interloper which has the
capaicty to severely damage our language.
Integer means either int , which is an abbreviation, or a number which is aOnce again, the term "integer" refers to a number of distinct types:
(signed|unsigned|plain) char, (signed|unsigned) (short|int|long|long
long),
and zero or more extended types. size_t is merely an alias for one of
them. That's just not going to change. If you dislike it, that's
certainly your right (though I'm at a loss to understand why you think
it's a problem), but it's how the language works.
whole number of units, or a number which for physical reasons can only be a
whole number of units. int is the normal integer types, the other types are
for special purposes.
Or was, until it was decide to use size_t as an array index.
If you've got problems knocking up a little language as an experiment IPerhaps you'd prefer B or BCPL?
You're free to use a different language that meets your needs if you
can find one, or design and implement one, or get someone else to do
so, if you're technically and/or financially able. The result is
likely to be something that *I* wouldn't want to use, but that's
perfectly fine.
recommend my book "MiniBasic, how to write a script interpreter". Minibasic
simply has numbers, implemeted as doubles, and strings. However it isn't
meant to be efficient.
Language isn't like that.But if you're going to post here, I suggest that keeping the
distinction between "int" and "integer" clear is going to make
communication much easier.
KISS. Keep it simple, stupid. We don't need this distinction, so lets get
rid of size_t and start a campaign for 64 bit ints.