(long)&((FLASH_CONF_STRUCT*)0)->vlan
FLASH_CONF_STRUCT is a struct type, and vlan is a member of this struct.
How to spell this expression?
(long)&((FLASH_CONF_STRUCT*)0)->vlan
FLASH_CONF_STRUCT is a struct type, and vlan is a member of this struct.
How to spell this expression?
(FLASH_CONF_STRUCT*)is a type cast. It's casting0to a pointer that points to aFLASH_CONF_STRUCT. Let's call thisptr.ptr->vlanis equivalent to(*ptr).vlan. It accesses thevlanfield of the structure pointed byptr.&gets the address of what follows, so the offset ofvlanadded toptr.(long)casts the address to along.Overall, this is meant to get the offset of
vlanwithin the structure. But I suspect it invokes Undefined Behaviour (because it dereferences a NULL pointer, at the very least). And it does so needlessly.Replace
with the far more readable
For example,
Output: