Initial commit of newLISP.
[newlisp.git] / util / types.c
blob8a486d5633a0ce530d6b1c6728024b2bdd9c28b8
1 /* types.c -- find out size of data types */
3 /*
5 output on Mac OS X PPC
7 type bytes
8 ---------------
9 char 1
10 char * 4
11 void * 4
12 short int 2
13 int 4
14 long 4
15 long int 4
16 long long 8
17 float 4
18 double 8
19 wchar_t 4
21 output on AMD64
23 type bytes
24 ---------------
25 char 1
26 char * 8
27 void * 8
28 short int 2
29 int 4
30 long 8
31 long int 8
32 long long 8
33 float 4
34 double 8
35 long double 16
36 wchar_t 4
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <wchar.h>
44 int main(int argc, char * argv[])
46 printf("\n");
47 printf("type bytes\n");
48 printf("---------------\n");
49 printf("char %d\n", sizeof(char));
50 printf("char * %d\n", sizeof(char *));
51 printf("void * %d\n", sizeof(void *));
52 printf("short int %d\n", sizeof(short int));
53 printf("int %d\n", sizeof(int));
54 printf("long %d\n", sizeof(long));
55 printf("long int %d\n", sizeof(long int));
56 printf("long long %d\n", sizeof(long long));
57 printf("size_t %d\n", sizeof(size_t));
58 printf("float %d\n", sizeof(float));
59 printf("double %d\n", sizeof(double));
60 printf("long double %d\n", sizeof(long double));
61 printf("wchar_t %d\n", sizeof(wchar_t));
63 printf("\n");
64 printf("format input output\n");
65 printf("------------------------------------------------\n");
66 printf("%%d 0xffffffff %d\n", 0xffffffff);
67 printf("%%u 0xffffffff %u\n", 0xffffffff);
68 printf("%%d 0x7fffffff %d\n", 0x7fffffff);
69 printf("%%u 0x7fffffff %u\n", 0x7fffffff);
70 printf("%%d 0x80000000 %d\n", 0x80000000);
71 printf("%%u 0x80000000 %u\n", 0x80000000);
72 printf("%%d 0x7fffffffffffffffLL %d\n", 0x7fffffffffffffffLL);
73 printf("%%u 0x7fffffffffffffffLL %u\n", 0x7fffffffffffffffLL);
74 printf("%%x 0xffffffffffffffffLL %x\n", 0xffffffffffffffffLL);
75 printf("%%X 0x7fffffffffffffffLL %x\n", 0x7fffffffffffffffLL);
76 printf("%%X 0x8000000000000000LL %x\n", 0x8000000000000000LL);
77 printf("%%llX 0xFFFFFFFFFFFFFFFFLL %x\n", 0xFFFFFFFFFFFFFFFFLL);
78 printf("%%llX 0x7FFFFFFFFFFFFFFFLL %x\n", 0x7FFFFFFFFFFFFFFFLL);
79 printf("%%llX 0x8000000000000000LL %x\n", 0x8000000000000000LL);
80 #ifndef TRU64
81 printf("%%lld 0xffffffffffffffffLL %lld\n", 0xFFFFFFFFFFFFFFFFLL);
82 printf("%%llu 0xffffffffffffffffLL %llu\n", 0xFFFFFFFFFFFFFFFFLL);
83 printf("%%lld 0x7fffffffffffffffLL %lld\n", 0x7fffffffffffffffLL);
84 printf("%%llu 0x7fffffffffffffffLL %lld\n", 0x7fffffffffffffffLL);
85 printf("%%lld 0x8000000000000000LL %lld\n", 0x8000000000000000LL);
86 printf("%%llu 0x8000000000000000LL %llu\n", 0x8000000000000000LL);
87 #else
88 printf("%%ld 0xffffffffffffffffLL %ld\n", 0xFFFFFFFFFFFFFFFFLL);
89 printf("%%lu 0xffffffffffffffffLL %ld\n", 0xFFFFFFFFFFFFFFFFLL);
90 printf("%%ld 0x7fffffffffffffffLL %ld\n", 0x7FFFFFFFFFFFFFFFLL);
91 printf("%%lu 0x7fffffffffffffffLL %lu\n", 0x7FFFFFFFFFFFFFFFLL);
92 printf("%%ld 0x8000000000000000LL %ld\n", 0x8000000000000000LL);
93 printf("%%lu 0x8000000000000000LL %lu\n", 0x8000000000000000LL);
94 #endif
96 exit(0);