Search code examples
cpointersassemblyx86-64void-pointers

How are void pointers implemented?


I was wondering how void pointers are implemented. I tried to find it out on Godbolt with x86-64 (you can see it here), but it didn't reveal anything. How are void pointers implemented?

Edit: This is the code I used:

int main() {
    int volatile y = 123;
    void* volatile x = &y;
}

All I was trying to see here is what x would look like. I put volatile so that gcc wouldn't eliminate it as dead code.


Solution

  • Generally speaking, all pointers on an x86-64 processor are simply 8 byte values containing some memory address. Only the compiler cares about what they point it.