Re: [gtk-list] Re: Drag and Drop, try 1



Ian Main <slow@intergate.bc.ca>
> Something interesting to think about :)

Not so very.  You can kill any program in any language by linking in
enough unused libraries.

$ gcc hello_world.c -ldb -lfbm -lform -lg++ -lgdbm -lgdk -lglib -lgtk -ljpeg -lm -lmenu -lncurses -lndbm -lnewt -lpanel -lpbm -lpgm -lpng -lpnm -lppm -lqt -lreadline -lrle -lslang -lsnmp -lstdc++ -ltcl -ltiff -ltk -lvga -lvgagl -lz
$ time ./a.out
hello world
0.27user 0.04system 0:01.20elapsed 25%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (556major+22minor)pagefaults 0swaps

To compile this program as C++, use "gcc -x c++ hello_world.c" or
rename it to hello_world.cpp and just "gcc hello_world.cpp".  I get
the exact same times as for C and C++:

$ gcc hello_world.c
$ time ./a.out
hello world
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (59major+7minor)pagefaults 0swaps

Next, I compile the program as C++, but without linking in any
libraries the program doesn't use:

$ mv hello_world.c hello_world.cpp
$ gcc hello_world.cpp
hello_world.cpp: In function `int main()':
hello_world.cpp:3: warning: implicit declaration of function `int printf(...)'
$ time ./a.out
hello world
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (59major+7minor)pagefaults 0swaps

--Arnt



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]