delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/19/09:51:27

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
X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: problem with sizeof struct alignment
Date: Wed, 19 Nov 2003 14:48:33 -0000
Message-ID: <CDDF0C56FD28F74CA268185D6EABD63303DA0BEB@i2km38-ukdy.domain1.systemhost.net>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: <kevin DOT lawton AT bt DOT com>
To: <dru AT treshna DOT com>, <cygwin AT cygwin DOT com>
X-OriginalArrivalTime: 19 Nov 2003 14:48:34.0034 (UTC) FILETIME=[34D2BD20:01C3AEAC]
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id hAJEpQo2003819

20 in hexadecimal is 32 in decimal.   
   
-----Original Message-----
From: Andrew Hill [mailto:dru AT treshna DOT com]
Sent: 19 November 2003 12:57
To: cygwin AT cygwin DOT com
Subject: problem with sizeof struct alignment

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.

--
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/


--
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/


- Raw text -


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