Skip to content

Instantly share code, notes, and snippets.

@HQarroum
Last active August 4, 2021 00:29
Show Gist options
  • Save HQarroum/d69e86a9f8ab1774c7ac1d77a248da09 to your computer and use it in GitHub Desktop.
Save HQarroum/d69e86a9f8ab1774c7ac1d77a248da09 to your computer and use it in GitHub Desktop.
my_offsetof
#define my_offsetof(ptr, member_name) \
(((size_t) (&(ptr)->member_name)) - ((size_t) ptr))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment