1 //This programme check size of datatypes
3 /* Copyright (c) 2010. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
16 int si = sizeof(short int);
18 int li = sizeof(long int);
19 int lli = sizeof(long long int);
20 int f = sizeof(float);
21 int v = sizeof(void *);
22 int vv = sizeof(void (*) (void));
23 /*printf("char : %d\n",c);
24 printf("short int : %d\n",si);
25 printf("int : %d\n",i);
26 printf("long int : %d\n",li);
27 printf("long long int : %d\n",lli);
28 printf("float : %d\n",f);
29 printf("void * : %d\n",v);
30 printf("void (*) (void) : %d\n",vv);*/
32 struct s0 {char c0; char i0;};
33 struct s1 {char c1; short int i1;};
34 struct s2 {char c2; int i2;};
35 struct s3 {char c3; long int i3;};
36 struct s4 {char c4; long long int i4;};
37 struct s5 {char c5; double i5;};
38 struct s6 {char c6; void * i6;};
39 int res0=sizeof(struct s0)-sizeof(char);
40 int res1=sizeof(struct s1)-sizeof(short int);
41 int res2=sizeof(struct s2)-sizeof(int);
42 int res3=sizeof(struct s3)-sizeof(long int);
43 int res4=sizeof(struct s4)-sizeof(long long int);
44 int res5=sizeof(struct s5)-sizeof(double);
45 int res6=sizeof(struct s6)-sizeof(void *);
46 /*printf("struct-char : %d\n",res0);
47 printf("struct-short int : %d\n",res1);
48 printf("struct-int : %d\n",res2);
49 printf("struct-long int : %d\n",res3);
50 printf("struct-long long int : %d\n",res4);
51 printf("struct-double : %d\n",res5);
52 printf("struct-void * : %d\n",res6);*/
54 printf("_C:%d/%d:_I:%d/%d:%d/%d:%d/%d:%d/%d:_P:%d/%d:%d/%d:_D:4/%d:8/%d:",c,res0,si,res1,i,res2,li,res3,lli,res4,v,res6,vv,res6,f,res5);