Signed word lengths and indexes
Adam Ruppe
destructionator at gmail.com
Tue Jun 15 08:26:34 PDT 2010
Not referring to anyone in particular, but it just occurred to me:
Python's use of -1 to mean length, and -2 to mean length -1 isn't
signed ints... it is using overflow! .... sort of. The thing is that
they are overflowing at a dynamic amount (array.length) instead of the
fixed size.
Actually, if it is treated as full blown proper overflow, you could
get some potentially useful stuff out of it. Given length == 5, -1 >
3. I don't know if Python actually lets you do that, but I doubt it.
But I just had a chuckle about that thought :)
More information about the Digitalmars-d
mailing list