Skip to content

Instantly share code, notes, and snippets.

@krono
Last active October 2, 2015 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krono/210c2ccbd69e74097f61 to your computer and use it in GitHub Desktop.
Save krono/210c2ccbd69e74097f61 to your computer and use it in GitHub Desktop.
ID shadowing?
struct {int foo;} snarfu;
/*
*/
#define WRAP(x) x
/*
*/
snarfu;
snarfu();
WRAP(snarfu);
WRAP(snarfu());
/*
*/
#define snarfu() snarfu
/*
*/
snarfu;
snarfu();
WRAP(snarfu);
WRAP(snarfu());
/*
*/
#undef snarfu
#define snarfu() WRAP(snarfu)
/*
*/
snarfu;
snarfu();
WRAP(snarfu);
WRAP(snarfu());
/********/
((WRAP(snarfu).foo)) <= (WRAP(x) + y);
#define mytest(x) ((x)||error(#x "foo"))
mytest(((WRAP(snarfu).foo)) <= (WRAP(x) + y));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment