Extra padding may be added to a structure by the compiler to meet alignment requirements as long and pointer fields grow to 64 bits for LP64. In the 64-bit environment on SPARC platforms, all types of structures are aligned to at least the size of the largest quantity within them. A simple rule for repacking a structure is to move the long and pointer fields to the beginning of the structure and rearrange the rest of the fields--usually, but not always, in descending order of size, depending on how well they can be packed. For example,
struct bar {
int i;
long j;
int k;
char *p;
}; /* sizeof (struct bar) = 32 */
For better results, use:
struct bar {
char *p;
long j;
int i;
int k;
}; /* sizeof (struct bar) = 24 */