X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Message-ID: <4959125A.6020708@x-ray.at> Date: Mon, 29 Dec 2008 19:09:30 +0100 From: Reini Urban User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.8.1.19) Gecko/20081204 SeaMonkey/1.1.14 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Cygwin struct alignment References: <006b01c965c1$6a7c6300$4001a8c0 AT mycomputer> <003a01c965fe$539063c0$4001a8c0 AT mycomputer> <495291CD DOT 1000207 AT bmts DOT com> <004701c96993$ea2fa5f0$4001a8c0 AT mycomputer> In-Reply-To: <004701c96993$ea2fa5f0$4001a8c0@mycomputer> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Note-from-DJ: This may be spam John Emmas schrieb: > ----- Original Message ----- From: "Ralph Hempel" > Sent: 24 December 2008 19:47 > Subject: Re: Cygwin struct alignment >> >> 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? Which "Cygwin compiler"? I have about a dozen compilers in my cygwin environment. If you mean gcc-core-3.4.4-3 or gcc-mingw-core-3.4.4-20050522-1 please say so. Cygwin per se infers no struct alignment at all, nor exists one "Cygwin compiler" only. For the record: There's also gcc4-core-4.3.2-1, for the C side, and of course various other compilers, such as clisp, parrot, chicken, gcc-g++, gcc4-g++, gcc-gpc, gcc-java, gcc-g77, gcc-ada, jikes, SWI-Prolog, cocom, ocaml, and from other sites bigloo, ikarus, plt. And there are various other cross-gcc packages around. Most with different "struct" or "record" packing and alignments. I haven't got llvm, ghc, and Modula-3 working yet. -- Reini Urban http://phpwiki.org/ http://murbreak.at/ -- 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/