Hacker News new | ask | show | jobs
by astrange 1011 days ago
That's not true, it is merely true on most ABIs. The only case where C really erases this information is casting to uintptr_t and back.
2 comments

Unless it is clearly specified on the ISO C standard, it is true in practice, and something that is impossible to rely on.
gcc also has some builtins to check pointer sizes when the compiler is able to figure it out.

https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Object-Size-Che...

Which is why I harp on the idea that the real problem is the gold bricks on WG14 who are intentionally blocking improvements to make C safer.

Also point out that if you can implement C on 16bit 0x86's segmented architecture you can certainly implement C with phat pointers too.