D design problem on platforms with <32 bit pointer width

sighoya sighoya at gmail.com
Sat Aug 19 12:58:48 UTC 2023


On Saturday, 19 August 2023 at 10:55:45 UTC, Dukc wrote:
> Inference happens at initialisation of the variable. In this 
> case, it's `ubyte` because nothing bigger is needed to hold the 
> initialisation value. Inference can't detect what is needed 
> later, that is why int literals default to 32 bits.

It would be better if 8 bit or 16 bit systems provide some sort 
of segmented pointer such that allocating 32 bit would be require 
a `struct Ptr {ubyte firstSegment, ubyte secondSegment, ubyte 
thirdSegment, ubyte fourthSegment}` on 8 bit architecture and 
`struct Ptr {ubyte firstSegment, ubyte secondSegment}` on 16 bit 
systems.




More information about the Digitalmars-d mailing list