M
Martin Wells
jacob:
Fair enough. Then all you need is a signed integer type whose positive
range is at least that of "size_t". I suppose the Standard could have
provided such a type, but it would probably be horribly inefficient
as, on a lot of systems in anyway, it would entail tagging a byte onto
the end of a size_t. For instance, let's say that size_t is 64-Bit on
a particular system, and that the max register size on this system is
64-Bit. Well we'll need 65 bits if we want a signed type, but this
will have to be implemented under-the-hood as a 64-Bit value
accompanied by a byte to say whether its positive or negative.
The other option was to allow the competent programmer to solve his
problem.
If you're guaranteed to be working with sizes smaller than 32767, then
by all means use int. You might want to you casts in places though if
you're to suppress compiler warnings.
Martin
But that is not the point. The point is that you have to take care of
this stuff you see?
Many people (me included) would rather NOT TAKE CARE OF THIS STUFF
Fair enough. Then all you need is a signed integer type whose positive
range is at least that of "size_t". I suppose the Standard could have
provided such a type, but it would probably be horribly inefficient
as, on a lot of systems in anyway, it would entail tagging a byte onto
the end of a size_t. For instance, let's say that size_t is 64-Bit on
a particular system, and that the max register size on this system is
64-Bit. Well we'll need 65 bits if we want a signed type, but this
will have to be implemented under-the-hood as a 64-Bit value
accompanied by a byte to say whether its positive or negative.
The other option was to allow the competent programmer to solve his
problem.
If you're guaranteed to be working with sizes smaller than 32767, then
by all means use int. You might want to you casts in places though if
you're to suppress compiler warnings.
Martin