logoalt Hacker News

spwa4 • today at 3:18 PM • 6 replies • view on HN

There is no difference.

Yes, I'm a C programmer, how did you know?


Replies

HarHarVeryFunny • today at 5:22 PM

C doesn't provide any guaranteed that a pointer can be stored in an integer.

The language only guarantees that an integer is at least 16 bits. There is no guarantee that a compiler that supports a > 16 bit address space will chose to make integers large enough to hold a pointer, and for example gcc still uses 32-bit integers for 64-bit processors.

I'm not sure if C even requires a pointer to be just a linear address, as opposed to something structured.

Ohentis • today at 3:28 PM

It doesn't sound like you are or you would know C doesn't define either precisely enough to make that statement true.

➕ show 2 replies
yxhuvud • today at 3:42 PM

There is a counter example in the OP.

Ungh • today at 3:34 PM

There's the voice of a C programmer who hasn't used hardware with a different word size to address space...

coolius • today at 4:39 PM

I agree, I have passed void* to the JVM by casting to int more often than I can count

drfloyd51 • today at 3:23 PM

You should read TFA.