Created
May 14, 2014 03:37
-
-
Save cjfuller/789f328597265088d39f 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
// Without `int`: | |
// First test (fails with link error since it can't find the function): | |
#include <stdio.h> | |
#include </usr/include/atlas/clapack.h> | |
/*top*/ | |
extern int t(void); | |
int main(int argc, char **argv) | |
{ | |
if (argc > 1000000) { | |
printf("%p", &t); | |
} | |
return 0; | |
} | |
int t(void) { void ((*volatile p)()); p = (void ((*)()))clapack_dgetrf; return 0; } | |
//Second test (fails with error that we've supplied too few arguments to clapack_dgetrf (since we've supplied none) ): | |
#include <stdio.h> | |
#include </usr/include/atlas/clapack.h> | |
/*top*/ | |
extern int t(void); | |
int main(int argc, char **argv) | |
{ | |
if (argc > 1000000) { | |
printf("%p", &t); | |
} | |
return 0; | |
} | |
int t(void) { clapack_dgetrf(); return 0; } | |
// With int: | |
// First test (fails due to syntax error): | |
#include <stdio.h> | |
#include </usr/include/atlas/clapack.h> | |
/*top*/ | |
extern int t(void); | |
int main(int argc, char **argv) | |
{ | |
if (argc > 1000000) { | |
printf("%p", &t); | |
} | |
return 0; | |
} | |
int t(void) { void ((*volatile p)()); p = (void ((*)()))int clapack_dgetrf; return 0; } | |
// Second test (succeeds because it's now just a function declaration): | |
#include <stdio.h> | |
#include </usr/include/atlas/clapack.h> | |
/*top*/ | |
extern int t(void); | |
int main(int argc, char **argv) | |
{ | |
if (argc > 1000000) { | |
printf("%p", &t); | |
} | |
return 0; | |
} | |
int t(void) { int clapack_dgetrf(); return 0; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment