From: yorka AT dlc DOT fi (aYk) Newsgroups: comp.os.msdos.djgpp Subject: Re: Size of a struct is not correct Date: Thu, 02 Jul 1998 23:54:12 GMT Organization: Majik Lines: 34 Message-ID: <359d1c56.1221191@news.dlc.fi> References: <01bda5a5$ce48b420$0100a8c0 AT dismuntel DOT ctv DOT es> NNTP-Posting-Host: cccxcvii.kdyn.saunalahti.fi Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 2 Jul 1998 12:40:18 +0200, "Javier Calleja" wrote: > >Hi world > > I have built the following struct: > > struct > { > char one; > short two,three; > long four > } foo; > > But when I do sizeof of this struct, the result is wrong (it says the >struct has 12 bytes). struct { char one __attribute__ ((packed)); short two, three __attribute__ ((packed)); long four __attribute__ ((packed)); } foo; - aYk - | Atte "Yorkaturr" Koivula - aYk - | | -------------------------------------- | | God of Evil | yorka AT dlc DOT fi | | Coder | yorka AT newbies DOT net | | Graphician | yorkaturr AT majik DOT netti DOT fi | | -------------------------------------- | | Majik MURPE - http://majik.netti.fi |