Unsigned versus signed numbers as indexes

Posted by simendsjo on Stack Overflow See other posts from Stack Overflow or by simendsjo
Published on 2010-06-17T08:30:44Z Indexed on 2010/06/17 8:33 UTC
Read the original article Hit count: 249

Filed under:
|
|
|

Whats the rationale for using signed numbers as indexes in .Net?

In Python, you can index from the end of an array by sending negative numbers, but this is not the case in .Net. It's not easy for .Net to add such a feature later as it could break other code perhaps using special rules (yeah, a bad idea, but I guess it happens) on indexing.

Not that I have ever have needed to index arrays over 2,147,483,647 in size, but I really cannot understand why they choose signed numbers.

Can it be because it's more normal to use signed numbers in code?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about unsigned