Hacker News new | past | comments | ask | show | jobs | submit login

That's... not really how it is.

At compile time, the compiler knows the type of a pointer, so it can interpret struct_ptr->field and do the proper arithmetic (field is 20 bytes offset into struct).

But when running, the pointers are just int64s on the stack. Check stdint.h. It's all right there.

Anyone writing C 'gets' roughly what's happening and knows the shape of their structs in memory.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: