D design problem on platforms with <32 bit pointer width

Walter Bright newshound2 at digitalmars.com
Mon Aug 21 05:44:11 UTC 2023


On 8/20/2023 8:48 PM, Richard (Rikki) Andrew Cattermole wrote:
> On 21/08/2023 7:13 AM, Walter Bright wrote:
>> Some things are impractical for D:
>>
>>  1. mixed near/far pointers
> 
> I've been thinking about this and I don't think that this is true.

I've lived with that problem for 20 years. If there was an answer, one of the 
compiler vendors would have found it. It's ugly, and there are all kinds of 
problems with it.

Interestingly, C++ compilers designed from the ground up to support multiple 
pointer types did work, up to a point. Compilers designed for 32 bit processors 
were never ported to near/far. It would be like a cyclone let loose on its innards.


> Add two new core.attributes udas.
> 
> ``enum near;`` and ``enum far;``
> 
> If we need segment support ``enum uda(string segment:"FS");`` would suffice.
> 
> Require it on all variable declarations, easy! Oh and don't forget to do 
> matching of argument/expression validation to declaration for @safe code.

That's only the beginning of the problems.


More information about the Digitalmars-d mailing list