Undefined behaviours in D and C

bearophile bearophileHUGS at lycos.com
Mon Apr 19 03:30:43 PDT 2010


Fawzi Mohamed:
> no the opposite is safe (pointer -> size_t) but there is no way size_t- 
> pointer can be safe...

In the stdint.h of C99 there is (optionally) uintptr_t that's is an unsigned int that is large enough to contain a pointer (there is a intptr_t too, signed). In C99 you use that to convert a pointer to an integral.

I don't know if D specs assert that D size_t is wide enough to represent a pointer.

Bye,
bearophile



More information about the Digitalmars-d mailing list