Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 20 Nov 2003 01:57:14 +1300 From: Andrew Hill Subject: problem with sizeof struct alignment To: cygwin AT cygwin DOT com Message-id: <3FBB68AA.6030409@treshna.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030430 Debian/1.3-5 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/