Dear
Does anybody know beter way to align members structure than described in spru187o.pdf ?
What document offer me (7.5.8.4 page 178) is of course not accepteble, every time I waste 8byte in structure(?!), this is example from document:
struct s
{
long not_used; /* 8-byte aligned */
short buf1[50]; /* also 8-byte aligned */
short buf2[50]; /* 4-byte aligned */
...
};
I wasting "not_used" variable what is 8bytes.
I tried no named union but do not working with compiler 6.1.11.
======================
struct s
{
long not_used; /* 8-byte aligned */
unsigned not_used2;
short buf1[50]; /* also 8-byte aligned */
short buf2[51]; /* */
union { /* no named union */
short buf3[12]; /* want to align to 8 or whatever */
long a;
};
};
struct s my_test;
my_test.buf3[0] = 1; <- compiler error
==============================
Of course I can used ordinary union but I am looking "proper solution".
Best Regards
/G. Konopko