X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 	tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <49CB5D56.5090301@sbcglobal.net>
Date: Thu, 26 Mar 2009 10:47:50 +0000
From: Greg Chicares <gchicares@sbcglobal.net>
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Problems when moving Ubuntu -> Cygwin -SOLVED
References: <fac6c19a0903260312p59871165gaf2e8fff62ac35d8@mail.gmail.com>
In-Reply-To: <fac6c19a0903260312p59871165gaf2e8fff62ac35d8@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 2009-03-26 10:12Z, Mikael Normark wrote:
> I addedd __attrubute__((packed)) to both structures and that made it
> all work as supposed to. Adding "packed" to the sample_pkg_t only
> saved 2 bytes, adding it to sample_t saved the rest down to 396 so
> obviously that structure is poorly aligned.
> The ultimate solution would be to use an aligned structure intstead of
> working around the problem like above, but this is good enough for me
> at this point.

This is a general C FAQ, and not a Cygwin issue--but using fread()
and fwrite() with structs is inherently not portable:
  http://c-faq.com/struct/io.html
and there's no guarantee it'll work even with two different versions
of the same compiler.

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

