←back to thread

Driving Compilers

(fabiensanglard.net)
161 points ibobev | 2 comments | | HN request time: 0s | source
Show context
gumby ◴[] No.41084337[source]
You can just say `make hello` — no Makefile required! And then run with `./hello` instead of invoking the more obscure a.out

Obviously that doesn’t scale, but for a beginner it’s simple.

replies(2): >>41085187 #>>41091454 #
1. vdm ◴[] No.41085187[source]
TIL

  $ ls
  $ cat >a.c <<EOF
  int main(){return 42;}
  EOF
  $ make a
  cc     a.c   -o a
  $ ./a; echo $?
  42
  $
replies(1): >>41088385 #
2. gumby ◴[] No.41088385[source]
I don't know about `ls`, but I typically type something so short on one line:

    $ echo 'int main(){return 42;}' > a.c; make a && ./a; echo $?