D Ranges in C#

Marco Leise Marco.Leise at gmx.de
Sat Jun 1 17:21:02 PDT 2013


Am Sat, 01 Jun 2013 23:20:19 +0200
schrieb "renoX" <renozyx at gmail.com>:

> On Saturday, 1 June 2013 at 18:23:31 UTC, Mehrdad wrote:
> [cut]
> >
> > You shouldn't be using 32-bit indices on x64, that defeats the 
> > whole point of x64.
> 
> Some would disagree: have a look at x32: 
> http://en.wikipedia.org/wiki/X32_ABI
> Being able to use efficiently 64 bit doesn't mean that you *have* 
> to use 64bit when 32bit is enough..
> renoX

No wait, the whole 'efficiency' point was that on x64 you
don't have to waste memory with the native word size for
indexes, but can go with 32-bits. So it saves memory.

But Mehrdad argued that we have x64 to be able to address
beyond 2^32 (bytes, items, objects). And 32-bit indexes in
generic code are thus asking for overflow bugs on x64 one day.

x32 adds nothing to the discussion as you'd always use 32-bit
indexes there. There is no point in storing more than 2^32
items when the address space is 32-bit. (Exceptions: bit
arrays, file offsets, etc.)

-- 
Marco



More information about the Digitalmars-d mailing list