14 int main(int argc, char *argv[])
18 printf("%d ",sizeof(long));
19 printf("%d ",sizeof(short));
20 printf("%d ",sizeof(int));
31 gcc myctest.c
-o myctest
33 if [ `./myctest |cut -d' ' -f 1` != 4 ]
34 then echo "#error sizeof(long)!=4"
36 if [ `./myctest |cut -d' ' -f 2` != 2 ]
37 then echo "#error sizeof(short)!=2"
39 if [ `./myctest |cut -d' ' -f 3` != 4 ]
40 then echo "#error sizeof(int)!=4"
43 if [ `./myctest |cut -d' ' -f 4` = LITTLE
]
45 echo "#ifndef LITT_ENDIAN"
46 echo "#define LITT_ENDIAN 1"
47 echo "#endif /* LITT_ENDIAN */"
49 echo "#ifndef LITT_ENDIAN"
50 echo "#endif /* LITT_ENDIAN */"