hello, world地獄
Macで可能な限りhello, world.を作ってみた。
環境は、Xcodeをインストールしただけ。
C(hello.c)
#include <stdio.h> int main(){ printf("hello, world.\n"); return 0; }
%gcc -o hello hello.c %./hello
C++(hello.cpp)
#include <iostream> using namespace std; int main(){ cout << "hello, world." << endl; return 0; }
%g++ -o hello hello.cpp %./hello
Objective-C(hello.m)
#import <stdio.h> int main(){ printf("hello, world.\n"); return 0; }
%gcc -o hello hello.c -lobjc %./hello
perl(hello.pl)
print "hello, world.\n";
%perl hello.pl
<?php echo "hello, world.\n"; ?>
%php hello.php
ruby(hello.rb)
print "hello, world.\n";
%ruby hello.rb
python(hello.py)
print "hello, world.\n"
%python hello.py
java(hello.hava)
import java.util.*; public class hello{ public static void main(String[] args){ System.out.println("hello, world."); } }
%javac hello.java %java hello
shell script(hello.sh)
echo "hello, world.\n"
%./hello.sh
Apple Script(hello.scpt)
return "hello, world."
%osacompile -o hello hello.scpt %osascript ./hello
アセンブラ(hello.s)
global _start _start: push 14 push message push 1 push 0 mov eax, 4 int 0x80 push 0 push 0 mov eax, 1 int 0x80 message: db 'Hello, World.', 0x0a
%nasm -f macho -o hello.o hello.s %ld -e _start -o hello hello.o
もうちょい意味のあるプログラムじゃないと面白くないな。
QuartzComposerでゲームを作ろうとしたけど、面倒くさすぎる。組み合わせ回路でゲーム作るのと同じだもん。