I will break it like this:
(type *)0- cast 0to type pointer " type". those. imagine for a minute that there is an object of type " type" at memory address 0.
->member- look at the object for the field called member.
& - take the address of this.
You can also write it like this:
((size_t)((&((type *)x)->member) - x))
But we cheat and use 0so that there is no bias at the end.
source
share