Xref: news2.mv.net comp.os.msdos.djgpp:761 From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: __alignement__ in v2b5 Date: Sat, 3 Feb 1996 13:22:41 +0000 Organization: The University of York, UK Lines: 18 Message-ID: References: <4etntt$75b0 AT news DOT i-link DOT net> NNTP-Posting-Host: tower.york.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp > struct TestStruct > { > char var1; > short var2 __attribute__ ((packed)); > }; > > Can anyone tell me why this program produces: > > sizeof(TestStruct): 4 You specified that the short (var2) is packed, but didn't say anything about the char var1. I would imagine that giving both fields the packed attribute would produce the expected size of 3. Shawn Hargreaves If God is omnipotent, can he make a http://www.york.ac.uk/~slh100/ rock so heavy that he cannot lift it?