はろー64ビット
今日、親切なおにいさんが会社の検証用マシンにdebianをいれてくれました。
なんと、中身をみてびっくり!
$ uname -a Linux sag15 2.6.18-4-amd64 #1 SMP Mon Mar 26 11:36:53 CEST 2007 x86_64 GNU/Linux $ gcc -v Using built-in specs. Target: x86_64-linux-gnu
をを!!64ビット環境じゃん(笑)
自慢じゃないですが初めてさわります。
で、まず最初にやったこと。
$ vi test.c #include<stdio.h> int main(int argc,char *argv[]){ printf("hello 64bit!!\n"); printf("char=%d short=%d int=%d long=%d longlong=% double=%d\n", sizeof(char),sizeof(short),sizeof(int),sizeof(long), sizeof(long long int),sizeof(double)); return(0); }
で、
$ gcc -o test test.c $ ./test hello 64bit!! char=1 short=2 int=4 long=8 longlong=8 double=8
ちなみに32ビットの環境だとこうなります。
$ gcc -o test test.c $ ./test hello 32bit!! char=1 short=2 int=4 long=4 longlong=8 double=8
へえ、longが8バイトになってるだけで、他は変わらないんですね。