From owner-freebsd-questions Mon Aug 5 12:11:50 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D5E537B400 for ; Mon, 5 Aug 2002 12:11:47 -0700 (PDT) Received: from mail1.hd.intel.com (hdfdns01.hd.intel.com [192.52.58.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3FD4A43E6E for ; Mon, 5 Aug 2002 12:11:46 -0700 (PDT) (envelope-from pavan.balaji@intel.com) Received: from fmsmsxvs040.fm.intel.com (fmsmsxvs040.fm.intel.com [132.233.42.124]) by mail1.hd.intel.com (8.11.6/8.11.6/d: solo.mc,v 1.42 2002/05/23 22:21:11 root Exp $) with SMTP id g75JBjt29920 for ; Mon, 5 Aug 2002 19:11:45 GMT Received: from fmsmsx28.fm.intel.com ([132.233.42.28]) by fmsmsxvs040.fm.intel.com (NAVGW 2.5.2.11) with SMTP id M2002080512104904586 ; Mon, 05 Aug 2002 12:10:49 -0700 Received: by fmsmsx28.fm.intel.com with Internet Mail Service (5.5.2653.19) id ; Mon, 5 Aug 2002 12:11:43 -0700 Message-ID: <3D386AED1B47D411A94300508B11F18704AD699A@fmsmsx116.fm.intel.com> From: "Balaji, Pavan" To: "'Matthew Seaman'" , "Balaji, Pavan" Cc: "'freebsd-questions@freebsd.org'" Subject: RE: GCC versions!!! Date: Mon, 5 Aug 2002 12:11:39 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG That was my guess. But, now how do I set it right, if I'm working on transferring data between two such machines? Pavan Balaji, Intel Corporation Email: pavan.balaji@intel.com "Only the Paranoid Survive" -- Andy Grove > -----Original Message----- > From: Matthew Seaman [mailto:m.seaman@infracaninophile.co.uk] > Sent: Monday, August 05, 2002 3:09 AM > To: Balaji, Pavan > Cc: 'freebsd-questions@freebsd.org' > Subject: Re: GCC versions!!! > > > On Sun, Aug 04, 2002 at 07:09:16PM -0700, Balaji, Pavan wrote: > > > > I ran this program on FreeBSD (GCC version 2.95.3) and the > output for this > > program was > > 1 256 65536 0 > > > > I reran it on Linux (GCC version 3.0.something) and the output was: > > 16777216 65536 1 0 (as expected). > > > > After a little poking around, I could figure out that the > memory for the > > structure was allocated in a way that for every word > boundary, the bytes > > allocation is in the reverse order. For example, if I have > 4 characters in a > > structure a, b, c and d, the memory for d is allocated > first, then c, then b > > and finally a. > > > > Is this something to do with gcc or with freebsd? Any ideas? > > I get exactly the same output with the standard gcc-2.95.4 and with > gcc-3.1.1 from ports: > > happy-idiot-talk:/tmp:% cc -v > Using builtin specs. > gcc version 2.95.4 20020320 [FreeBSD] > happy-idiot-talk:/tmp:% cc -o foo-2.95.4 foo.c > [...] > happy-idiot-talk:/tmp:% ./foo-2.95.4 > 1 256 65536 0 > > happy-idiot-talk:/tmp:% gcc31 -v > [...] > gcc version 3.1.1 [FreeBSD] > happy-idiot-talk:/tmp:% gcc31 -o foo-3.1.1 foo.c > [...] > happy-idiot-talk:/tmp:% ./foo-3.1.1 > 1 256 65536 0 > > I doubt there's a difference at this level between gcc on Linux or > FreeBSD: this sort of alignment/endianness issue is mostly a function > of the CPU the code is running on. At a guess, your second result was > obtained on a Sparc or PowerPC[*] or similar CPU, which is the > other-endian from an x86 class CPU: I never can rememder which one is > 'big-endian' and which one is 'little-endian' though. > > Matthew > > [*] PowerPC can work 'either-endian' but I thing most Unix OS's select > this way. > > -- > Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks > Savill Way > Tel: +44 1628 476614 Marlow > Fax: +44 0870 0522645 Bucks., > SL7 1TH UK > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message