www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/04/07:14:21

From: "Alexandre Devaure" <Alexandre DOT Devaure AT leroy-autom DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000504141054 DOT 18008C AT is>
Subject: Re: structures size
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <_EdQ4.3797$VI7.8365112@nnrp5.proxad.net>
Date: Thu, 04 May 2000 12:02:02 GMT
NNTP-Posting-Host: 194.51.236.59
X-Complaints-To: abuse AT proxad DOT net
X-Trace: nnrp5.proxad.net 957441722 194.51.236.59 (Thu, 04 May 2000 14:02:02 CEST)
NNTP-Posting-Date: Thu, 04 May 2000 14:02:02 CEST
Organization: Guest of ProXad - France
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> a écrit dans le message :
Pine DOT SUN DOT 3 DOT 91 DOT 1000504141054 DOT 18008C AT is...
>
> On Thu, 4 May 2000, Alexandre Devaure wrote:
>
> > struct l {
> >         uchar c;
> >         uint o;
> >         uint s;
> > };
> > struct st {
> >         struct l l;
> >         ulong d;
> >         uchar i;
> >         uchar t;
> >         ulong n;
> > };
> >
> > main()
> > {
> >         printf("%d\n",sizeof(struct st));
> > }
> >
> > the command line is gcc -fpack-struct file.c
>
> 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.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019