VariantPointer

Lass Safin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 20 08:57:38 PDT 2016


On Wednesday, 20 April 2016 at 13:41:27 UTC, Nordlöw wrote:
> At
>
> https://github.com/nordlow/phobos-next/blob/master/src/variant_pointer.d
>
> I've implemented a pointer-only version of Variant called 
> VariantPointer.
>
> [...]
>
> It safe to assume that `typeBits` most significant bits of a 
> pointer on a 64-bit system are always zero?
>
> Note that I didn't want to use the lower bits because I'm 
> currently unsure whether I need to represent stack-pointers 
> aswell.

I'm very sure that there is no obligation for the OS to not issue 
a stack of memory starting at addresses near the limit of a 
64-bit system. Thus, you can't count on it 100% of the time, 
though it is so rare as far as I know, that a simple enforce() 
for checking that the upper bits are clear should be acceptable. 
Though, it may perhaps be unusable in a few decades time, if you 
still care then.

I can't answer your second question.


More information about the Digitalmars-d-learn mailing list