Skip to content

Instantly share code, notes, and snippets.

@michaelbartnett
Last active July 12, 2016 04:23
Show Gist options
  • Select an option

  • Save michaelbartnett/0baa5c67f762e39c5bb0718d3388ef66 to your computer and use it in GitHub Desktop.

Select an option

Save michaelbartnett/0baa5c67f762e39c5bb0718d3388ef66 to your computer and use it in GitHub Desktop.
void foo_base()
{
printf("fool\n");
}
#define FooFunction foo_base
#include "foo_base.c"
#ifndef FooFunction
#error why is there no FooFunction
#endif
void foo_extended()
{
printf("i pity the ");
FooFunction();
}
#undef FooFunction
#define FooFunction foo_extended()
#inlude "foo_base.c"
void doathing()
{
printf("call FooFunction\n");
FooFunction();
}
#include "foo_base.c" // redundant, assume include guards
#include "foo_extended.c"
void doathing2()
{
printf("call FooFunction\n");
FooFunction();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment