Path: utzoo!utgpu!watserv1!watmath!att!rutgers!ucsd!pacbell.com!ames!sun-barr!newstop!texsun!texbell!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.std.c Subject: Re: Structure Member Padding Message-ID: <8LK4ID9@xds13.ferranti.com> Date: 10 Jul 90 15:35:33 GMT References: <1990Jul7.225141.12002@sq.sq.com> <13321@smoke.BRL.MIL> <10420@ogicse.ogc.edu> <13332@smoke.BRL.MIL> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 24 In article <10420@ogicse.ogc.edu> daniels@ogicse.ogc.edu (Scott David Daniels) writes: > struct first { char a; short s; }; > struct second{ char a; short s; char b; }; > struct third { char a; char b; short s; }; > I would like to be able to use the same layout for third and second, ... struct head { char a; short b; }; struct first { char a; short b; long c; }; struct second { char a; short b; char c; }; You want to shove second.c between second.a and second.b, right? copyhead(dest, src) struct head *dest, *src; { *dest = *src; } struct first a; struct second b; copyhead(b, a); You just clobbered b.c if you do that. -- Peter da Silva. `-_-' +1 713 274 5180.