This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cygwin struct alignment
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/