From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tuukka Tikkanen" To: "Steve Sun" , Subject: RE: Bug Report Date: Wed, 23 May 2001 13:07:00 -0000 Message-id: References: <20010523.19155200@otl.gte.com> X-SW-Source: 2001-05/msg00698.html List-Id: > I was surprised by the result of this simple program compiling with gcc > 2.95 on Red Hat Linux 7.0. > Could you check whether is it a bug of gcc 2.95 (for Red Hat Linux 7.0)? You are forgetting the endianess of x86 processors. The behaviour is exactly correct (ie. the numbers are printed in reverse order) for intel-based system whereas you will (and should) get different result on for example motorola 68000-based system. If you need to write code that is portable (and if you need to play with byte order) you should either use htonl(),htons(),ntohl(),ntohs() macros or #include endian.h and use the __BYTE_ORDER, __BIG_ENDIAN and __LITTLE_ENDIAN definitions. Tuukka