2008-11-26 :-)
_ 朝ッ
0530起床
_ 仕事
0830 出勤。
_ ウォッチしているはてなブックマークのフィードが急増していて驚いた
はてなブックマークニューアルしていてたか。
_ [型のバイト数][sizeof]型のバイト数を調べる: uyota 匠の一手
#!/bin/sh cat <<"EOF" >sizeoftype.c #include <stdio.h> int main(void) { printf("type\t\tbyte\n"); printf("void\t\t%zd\n", sizeof(void*)); printf("char\t\t%zd\n", sizeof(char)); printf("short\t\t%zd\n", sizeof(short)); printf("int\t\t%zd\n", sizeof(int)); printf("long\t\t%zd\n", sizeof(long)); printf("long long\t%zd\n", sizeof(long long)); printf("float\t\t%zd\n", sizeof(float)); printf("double\t\t%zd\n", sizeof(double)); printf("long double\t%zd\n", sizeof(long double)); return 0; } EOF gcc sizeoftype.c -o sizeoftype ./sizeoftype rm sizeoftype rm sizeoftype.c
たとえば i386 で実行してみる。
% ./sizeoftype.sh type byte void 4 char 1 short 2 int 4 long 4 long long 8 float 4 double 8 long double 12
[ツッコミを入れる]