I have a structure I would like to optimize the footprint of.
typedef struct dbentry_s {
struct dbentry_s* t_next;
struct dbentry_s* a_next;
char *t;
char *a;
unsigned char feild_m;
unsigned char feild_s;
unsigned char feild_other;
} dbentry;
As I understand it, the compiler creates structures in memory as you define them. So larger types should be declared first so the small types can fill in the alignment holes.
I have read the WikiPedia article on data structure alignment and other articles on the issue. http://en.wikipedia.org/wiki/Data_structure_alignment
But I'm still not sure, is my current ordering the most optimal or am I missing something?
Note: My compiler doesn't support "#pragma pack"