Difference between revisions of "Typesize.txt"
Jump to navigation
Jump to search
(New page: This pages records the results obtained by compiling and running [http://eagle.bsd.st/~jontow/typesize.txt typesize.c] on various platforms. If you have access to an OS/Platform not listed...) |
(add inline of typesize.c, since old link broke.) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This pages records the results obtained by compiling and running | + | This pages records the results obtained by compiling and running typesize.c on various platforms. If you have access to an OS/Platform not listed, feel free to add additional results. |
<pre> | <pre> | ||
Line 14: | Line 14: | ||
AIX/power/64bit 2 4 8 8 4 8 8 | AIX/power/64bit 2 4 8 8 4 8 8 | ||
IRIX/mips 2 4 4 8 4 8 16 | IRIX/mips 2 4 4 8 4 8 16 | ||
+ | </pre> | ||
+ | |||
+ | == typesize.c == | ||
+ | <pre> | ||
+ | #include <stdio.h> | ||
+ | |||
+ | int main(void) | ||
+ | { | ||
+ | char ca; | ||
+ | short int ia; | ||
+ | int ib; | ||
+ | long int ic; | ||
+ | long long int id; | ||
+ | float fa; | ||
+ | double da; | ||
+ | long double db; | ||
+ | |||
+ | |||
+ | printf("sizeof(char): %d\n", sizeof(ca)); | ||
+ | printf("sizeof(short int): %d\nsizeof(int): %d\nsizeof(long int): %d\nsizeof(long long int): %d\n",sizeof(ia), sizeof(ib), sizeof(ic), sizeof(id)); | ||
+ | printf("sizeof(float): %d\n", sizeof(fa)); | ||
+ | printf("sizeof(double): %d\nsizeof(long double): %d\n", sizeof(da), sizeof(db)); | ||
+ | |||
+ | return 0; | ||
+ | } | ||
</pre> | </pre> |
Latest revision as of 15:47, 5 December 2017
This pages records the results obtained by compiling and running typesize.c on various platforms. If you have access to an OS/Platform not listed, feel free to add additional results.
short int long long^2 float double long double Minix/i286 2 2 4 N/A 4 8 8 Minix/i486 2 4 4 N/A 4 8 8 FreeBSD/i686 2 4 4 8 4 8 12 OpenBSD/amd64 2 4 8 8 4 8 16 NetBSD/sparc32 2 4 4 8 4 8 8 OpenBSD/sparc64 2 4 8 8 4 8 16 NetBSD/alpha 2 4 8 8 4 8 8 HP-UX/hppa 2 4 4 8 4 8 8 AIX/power/32bit 2 4 4 8 4 8 8 AIX/power/64bit 2 4 8 8 4 8 8 IRIX/mips 2 4 4 8 4 8 16
typesize.c
#include <stdio.h> int main(void) { char ca; short int ia; int ib; long int ic; long long int id; float fa; double da; long double db; printf("sizeof(char): %d\n", sizeof(ca)); printf("sizeof(short int): %d\nsizeof(int): %d\nsizeof(long int): %d\nsizeof(long long int): %d\n",sizeof(ia), sizeof(ib), sizeof(ic), sizeof(id)); printf("sizeof(float): %d\n", sizeof(fa)); printf("sizeof(double): %d\nsizeof(long double): %d\n", sizeof(da), sizeof(db)); return 0; }