Skip to content

Instantly share code, notes, and snippets.

@simonask
Created August 9, 2009 21:38
Show Gist options
  • Save simonask/164911 to your computer and use it in GitHub Desktop.
Save simonask/164911 to your computer and use it in GitHub Desktop.
static int n = 0;
int make(int t) { return t; }
void foo_a() { ++n; }
void foo_b() { ++n; }
void foo_c() { ++n; }
void foo_d() { ++n; }
int foo(int t)
{
switch (t)
{
case 0:
foo_a();
break;
case 1:
foo_b();
break;
case 2:
foo_c();
break;
case 3:
foo_d();
break;
}
}
int main (int argc, char const *argv[])
{
int i;
for (i = 0; i < 10000000; ++i)
{
int a = make(0);
foo(a);
int b = make(1);
foo(b);
int c = make(2);
foo(c);
int d = make(3);
foo(d);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment