This, as I understand it, is completely legitimate c99:
>$ cat main.c
#include <stdio.h>
inline void foo()
{
printf("inline\n");
}
int main()
{
foo();
return 0;
}
>$ cat outline.c
#include <stdio.h>
void foo()
{
printf("out-of-line\n");
}
>$ clang -O0 -c main.c -o main.o && clang -O0 -c outline.c -o outline.o && clang -o inline-test-O0 main.o outline.o
>$ clang -O2 -c main.c -o main.o && clang -O2 -c outline.c -o outline.o && clang -o inline-test-O2 main.o outline.o
>$ ./inline-test-O0
out-of-line
>$ ./inline-test-O2
inline
No comments:
Post a Comment