Walter Bright Wrote: > Don wrote: > > I would strongly support that. But it doesn't really work. > > The problem is size_t. The fact that it's unsigned is a root of all > > kinds of evil. It means .length is unsigned!!! > > Personally I think that any creation or access to an object which is > > larger in size than half the memory space, should be impossible without > > a special function call. Providing syntax sugar for this incredibly rare > > scenario introduces a plethora of bugs. > > size_t is unsigned to line up with C's. ptrdiff_t is the signed version. You > can > do things like: > > ptrdiff_t d = a.length; > > Making size_t signed would have consequences that are largely unknown.
C# Array has signed length, on 64bit target I suppose, it asserts. And you can use .LongLength property for really large arrays. Who knows, how large arrays can get even on 32bit target?