2007-11-18から1日間の記事一覧

展開 2

$ cat a.c #include <stdio.h> extern inline int f() { return 1; } int main(void) { puts(f() ? "opt" : "no opt"); } $ cat b.c int f() { return 0; } $ gcc a.c b.c && ./a.out no opt $ gcc -O3 a.c b.c && ./a.out optinline + extern に関する GCC の*1セマ</stdio.h>…

言葉が足りない

FlashSort というソートアルゴリズムが O(n) で動くという話を見かけた。

展開

#include <stdio.h> #define A ( #define B ) #define puts(x) puts A x B #define f(x) x + 7 int main(void) { puts ( f A "Hello, World!" ) ); puts A f ( "Hello, World!" ) ); }</stdio.h>