From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: Re: structures size Date: Thu, 04 May 2000 23:54:30 +0400 Organization: MTU-Intel ISP Lines: 56 Message-ID: <3911D576.947D53CF@mtu-net.ru> References: NNTP-Posting-Host: ppp98-109.dialup.mtu-net.ru Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Trace: gavrilo.mtu.ru 957470087 46385 212.188.98.109 (4 May 2000 19:54:47 GMT) X-Complaints-To: usenet-abuse AT mtu DOT ru NNTP-Posting-Date: 4 May 2000 19:54:47 GMT X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: en,ru To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I've already mentioned that. Btw, isn't the following better than yours: ----------8<---------- #pragma pack (push, 1) // structure definitions #pragma pack (pop) ----------8<---------- ? bye. Alexei A. Frounze ----------------------------------------- Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru Andris Pavenis wrote: > > On Thu, 4 May 2000, Eli Zaretskii wrote: > > > > > On Thu, 4 May 2000, Alexandre Devaure wrote: > > > > > > What did you expect this program to print? > > > > > > I forgot to include the definition of the types used in the structures : > > > typedef unsigned short uint; > > > typedef unsigned char uchar; > > > typedef unsigned int ulong; > > > > > > And I want the size to be 15 bytes. > > > > It works for me, but not with GCC 2.95.x, which has a bug when you use > > the -fpack-struct switch, as explained in the FAQ. If you have that > > version of GCC, you will have to use __attribute__((packed)) instead. > > See section 22.11 of the DJGPP FAQ for more details. > > > > It's also possible to use > > #pragma pack(1) > > struct foo > { > ..... > }; > > #pragma pack() > > It works with gcc-2.95.2 (at least in my code written in C++) > > Andris