delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/04/03:15:02

>Received: from devaure by lai.leroy-autom.com; Thu, 4 May 2000 08:42:35 +0200
Message-ID: <005b01bfb593$eb5b1c60$3eefa8c0@leroyautom.com>
From: "Alexandre Devaure" <Alexandre DOT Devaure AT leroy-autom DOT com>
To: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Cc: <djgpp AT delorie DOT com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000504092557 DOT 16176B-100000 AT is>
Subject: Re: structures size
Date: Thu, 4 May 2000 08:42:29 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Reply-To: djgpp AT delorie DOT com

----- Original Message -----
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Alexandre Devaure <Alexandre DOT Devaure AT leroy-autom DOT com>
Cc: <djgpp AT delorie DOT com>
Sent: Thursday, May 04, 2000 8:27 AM
Subject: Re: structures size


>
> On Wed, 3 May 2000, Alexandre Devaure wrote:
>
> > I'd like the size of my structures is the same that in Borland C because
my
> > program need to read a structure in flash written by a program developed
> > under Borland C. So, I want to use the -fpack-struct option at
compilation
> > time. But it has no effect on the structure size and I need to add the
> > packed attribute on each structure.
>
> C programs or C++ programs?
>
> Can you post a short test program and its compilation command line, which
> can be used to reproduce this problem?
>


This is a C program :

#include <stdio.h>

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




- Raw text -


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