Last active
January 2, 2016 22:29
-
-
Save krono/8370437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void foo(void) { | |
static int barf=10; | |
barf++; | |
} | |
int main() | |
{ | |
printf("test: %d\n", (int)foo()); | |
printf("test: %d\n", (int)foo()); | |
return 0; | |
} | |
/* does not compile on | |
on clang 5, gcc-4.8 | |
BUT prints | |
test: 11 | |
test: 12 | |
on tcc 0.9.6 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void foo(void) { | |
static int barf=10; | |
barf++; | |
} | |
int (*foo_)(void) = (int(*)(void))foo; | |
int main() | |
{ | |
printf("test: %d\n", foo_()); | |
printf("test: %d\n", foo_()); | |
return 0; | |
} | |
/* prints | |
test: 11 | |
test: 12 | |
on clang 5, gcc-4.8, tcc 0.9.6 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment