4 ms·
The C standard guarantees Pointer to Struct ~ Pointer to (transitively)-initial Member (through casts, either directly or via `void*` or via `intptr_t`). It doe
by arielby 11y ago
The C standard guarantees Pointer to Struct ~ Pointer to (transitively)-initial Member (through casts, either directly or via `void*` or via `intptr_t`). It doesn't guarantee Pointer to Struct + offset ~ Pointer to non-initial Member for any value of offset.
- haberman 11y agoSo you can easily use &struct_var->member to go from pointer-to-struct to pointer-to-member. It sounds like you are claiming that there is no way to go back.