From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: erik quanstrom Date: Fri, 21 Dec 2007 19:20:26 -0500 To: 9fans@cse.psu.edu Subject: Re: [9fans] 8c padding problem In-Reply-To: <8ea9211edc9a0cad52683bcd6ae3f64d@9netics.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 203fa2ea-ead3-11e9-9d60-3106f5b1d025 > but it doesn't have to be. this is legit: > > typedef struct{ > Ehdr; // 1 > Ehdr; // 2 > uchar op[2]; > }Pkt; my explinations stink. perhaps this gets at what i'm saying better. the structure S0 won't have any padding, yet the two calls to frobehdr are just fine. i'm not sure i see the alignment problem that requires padding all unnamed structures. typedef struct{ uchar s[6]; uchar d[6]; uchar t[2] }Ehdr; frobehdr(Ehdr*) typedef struct{ uchar s0[6]; uchar d0[6]; uchar t0[2] uchar s1[6]; uchar d1[6]; uchar t1[2] }S0; void thunk0(void) { S0 *s; frobehdr((Ehdr*)s->s0); frobehdr((Ehdr*)s->s1); } - erik