delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/12/29/12:56:46

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 29 Dec 2008 12:55:34 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin struct alignment
Message-ID: <20081229175534.GB32743@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <006b01c965c1$6a7c6300$4001a8c0 AT mycomputer> <003a01c965fe$539063c0$4001a8c0 AT mycomputer> <495291CD DOT 1000207 AT bmts DOT com> <004701c96993$ea2fa5f0$4001a8c0 AT mycomputer>
MIME-Version: 1.0
In-Reply-To: <004701c96993$ea2fa5f0$4001a8c0@mycomputer>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Mon, Dec 29, 2008 at 09:00:36AM -0000, John Emmas wrote:
>On Mon, Dec 24, 2008 at 19:47 Ralph Hempel wrote:
>>John, if I understand you correctly, you are running up against a
>>classic problem in embedded systems programming.  Namely that you
>>cannot assume anything about structure packing, byte ordering, or
>>alignment when doing RPC or transmitting data across platforms.
>
>Yesterday I spent some time looking into this but didn't come to any
>hard & fast conclusions.  Variables themselves seem to correlate very
>well between MSVC and Cygwin (even 'long' which I thought was
>different).  But when calculating structure alignment (manually)
>sometimes Cygwin gave closer results to what I expected and sometime
>MSVC was closer.
>
>Before I try Ralph's suggestion I'd like (if possible) to try building
>both versions with struct packing disabled.  This is fairly simple to
>do with Microsoft's compiler (I just set the member alignment to '1
>byte') but can it be done for my Cygwin compiler - e.g.  with a
>compiler option or a #pragma or whatever?

All of the pragmas should be discussed in the "info gcc" documentation.
Just go to the "Pragmas" node or search for "Pragmas Accepted by GCC".

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