www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/12/24/14:33:06

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
X-Trace: 120122443/mk-filter-3.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/79.66.17.75/None/johne53 AT tiscali DOT co DOT uk
X-SBRS: None
X-RemoteIP: 79.66.17.75
X-IP-MAIL-FROM: johne53 AT tiscali DOT co DOT uk
X-MUA: Microsoft Outlook Express 6.00.2900.2180Produced By Microsoft MimeOLE V6.00.2900.2180
X-IP-BHB: Once
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AsoEAIccUklPQhFL/2dsb2JhbACEA1K6QFiQeYZC
Message-ID: <003a01c965fe$539063c0$4001a8c0@mycomputer>
From: "John Emmas" <johne53 AT tiscali DOT co DOT uk>
To: <cygwin AT cygwin DOT com>
References: <006b01c965c1$6a7c6300$4001a8c0 AT mycomputer>
Subject: Re: Cygwin struct alignment
Date: Wed, 24 Dec 2008 19:32:15 -0000
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Note-from-DJ: This may be spam

----- Original Message ----- 
From: "John Emmas"
Subject: Cygwin struct alignment
>
> I'd assumed that Cygwin probably wouldn't use structure packing (only
> because I don't think Linux does).  But I only get meaningful data with
> 8-byte packing.  It looks as if Cygwin's compiler must default to 8-byte
> packing too.  Does that make sense?
>
Actually, this is turning out to be slightly more complicated than
I thought.  Member alignment for very simple structs seems to correlate
pretty well but more complex structs cause subtle (though hopefully not
insurmountable) problems..

'bool' seems possibly to be a caveat (bool uses 4 bytes in MSVC but I don't
know how many bytes it uses in Cygwin).  Also, structs that contain arrays
don't quite line up between the two compilers.  In both cases, the total
size for a struct is usually bigger than the calculated size (i.e. the size
it would be if there was no member alignment) but Cygwin's seem generally to
be slightly larger than Microsoft's.

Is it possible (in Cygwin) to disable structure packing?  (I know this is
possible for MSVC).  Also, is there a handy reference where I could find out
more about the format and 'size' of basic Cygwin types?  Most of them are
obvious of course, but there are a few less obvious ones, like 'bool',
'float'  and 'enum' types.  I could also do with checking that the encoding
format for floats is compatible between the two compilers - or is it
processor dependent?  If I don't check, I'm bound to come unstuck (I'm
compiling for a 32-bit platform BTW).

Anywhere I can find out this kind of stuff??

And a happy Christmas to everyone !

John 


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