1 /* Copyright (c) 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include <stddef.h> /* offsetof() */
14 struct s0 {char c0; double d0;};
15 struct s1 {double d1; int i1; char c1;};
16 struct s2 {double d2; int i2; char c2[6];};
17 struct s3 {double d3; int a3; int b3;};
19 int gras_struct_packed;
20 int gras_struct_compact;
21 int gras_array_straddle_struct;
22 int gras_compact_struct;
24 if (sizeof(struct s0) == sizeof(double)+sizeof(char))
32 if (offsetof(struct s1,c1) == sizeof(double)+sizeof(int))
34 gras_struct_compact=1;
38 gras_struct_compact=0;
40 if (offsetof(struct s2,c2) == sizeof(double)+sizeof(int))
42 gras_array_straddle_struct=1;
46 gras_array_straddle_struct=0;
48 if (offsetof(struct s3,b3) == sizeof(double)+sizeof(int))
50 gras_compact_struct=1;
54 gras_compact_struct=0;
58 if(gras_struct_packed == 0 && gras_struct_compact == 1) printf("GRAS_STRUCT_COMPACT ");
60 if(gras_array_straddle_struct == 1) printf("GRAS_ARRAY_STRADDLE_STRUCT ");
62 if(gras_compact_struct == 1) printf("GRAS_COMPACT_STRUCT ");