delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Message-ID: | <3FBC1CDA.7090508@treshna.com> |
Date: | Thu, 20 Nov 2003 14:46:02 +1300 |
From: | Dru <andru AT treshna DOT com> |
User-Agent: | Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.5) Gecko/20031107 Debian/1.5-3 |
X-Accept-Language: | en-nz |
MIME-Version: | 1.0 |
To: | "Demmer, Thomas" <TDemmer AT krafteurope DOT com> |
CC: | "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>, |
"'dru AT treshna DOT com'" <dru AT treshna DOT com> | |
Subject: | Re: problem with sizeof struct alignment |
References: | <8D861ADC5B8FD211B4100008C71EA7DA04F712D2 AT kjsdemucshrexc1 DOT eu DOT pm DOT com> |
In-Reply-To: | <8D861ADC5B8FD211B4100008C71EA7DA04F712D2@kjsdemucshrexc1.eu.pm.com> |
Demmer, Thomas wrote: >Andrew Hill <dru at treshna dot com> wrote > > > >>I have this struct >> >> >>typedef struct { >>double arrival; >>double departure; >>char status; >>int bookingid; >>int userid; >>} RoomStatus; >> >> >>I'm using gcc with no compiler options or flags. Under linux with >>gcc, sizeof(RoomStatus) returns me 28 - as i would expect. If I use a >>borland C++ compiler it also returns a sizeof 28. But with cygwin + >>gcc it returns a sizeof 32. I'm a bit confused. Does cgwin + gcc align >>to nearest 8bytes for structs? Is there a compiler option to tell it >>to use 4 byte alignment? Is it just me whos having this problem? >> >>I checked the sizeof for int, double and char and they all correct, >>changing the char to an int or specifically saying its a 4bit int >>doens't seem to make any difference. >> >> > >gcc -mno-align-double >is your friend to achieve ABI compatibility. This mis-feature >was introduced with gcc-3.whatever. Search the mailing >list for a remark from Brian Ford giving a heads up on this problem. > > > Thanks I'll try that. Found the orginal post by Brian. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |