Poll: Primary D version

Walter Bright newshound1 at digitalmars.com
Sat May 22 20:19:41 PDT 2010


Sean Kelly wrote:
> Andrei Alexandrescu Wrote:
>> It all depends on what the largest payload is. One of my apps' largest 
>> structures was a hash, which was almost twice as large in the 64-bit 
>> version.
> 
> It's always possible to trim down the bits used for a pointer inside a data
> structure if the savings really matters.  Doing so can create some really
> interesting bugs though.

The 'reduced' pointer memory model is a bad fit for D because:

1. D has to work with the corresponding C compiler, which does not support such 
a memory model. This kills it right there.

2. This will kill off a lot of the benefits of having a large address space that 
have nothing to do with allocating a lot of memory. I mentioned these in another 
post.

3. Having to support 2 memory models doubles the work. Two libraries, two test 
suite runs, more documentation, inevitable user confusion and mismatching, 
everyone shipping a library has to ship two, etc.

If you must shrink the space required by pointers for a particular data 
structure, I suggest instead storing an offset instead of the pointer. Then, 
follow the indirection by adding said offset to a "base pointer".


More information about the Digitalmars-d mailing list