Skip to content

Instantly share code, notes, and snippets.

@ArnaudCourbiere
Created January 15, 2013 20:24
Show Gist options
  • Save ArnaudCourbiere/4541717 to your computer and use it in GitHub Desktop.
Save ArnaudCourbiere/4541717 to your computer and use it in GitHub Desktop.
/* Pointer magic to determine relative addresses of variables to a
struct context pointer */
#define CNT_OFFSET(varname) ((long)&((struct context *)NULL)->varname)
#define CONF_OFFSET(varname) ((long)&((struct context *)NULL)->conf.varname)
#define TRACK_OFFSET(varname) ((long)&((struct context *)NULL)->track.varname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment