by unwind · 10y ago · 0 comments
I'm sure everybody knows this, but here's "hello world" on the command line using GCC in e.g. Linux:
$ echo -e '#include <stdio.h>\nint main(void) { printf("hello, world!\\n"); return 0; }' > hello.c && gcc -o hello hello.c && ./hello
The most complicated thing here is probably the bash quoting/escaping (which explains the double backslash inside printf()'s arguments).The above command line spawns two processes, one of which is a full C compiler, and it runs in 3 milliseconds on my embarassingly old home laptop (Core-I5 M480 at 2.7 GHz).
I'm not trying to be the old fart claiming that everything was better back in the day, but this (to me) almost makes C seem as approachable as BASIC on the old 8-bit machines, when looking at the relative complexity.
java -cp cljs.jar clojure.main -e '(require (quote [cljs.build.api :as b])) (b/build (quote [(ns foo) (js/console.log "Hello world!")]) {:optimizations :advanced})'
But I'm not sure this is actually telling us anything.