Possible bug

Nathan Sidwell nathan@acm.org
Mon May 31 21:06:00 GMT 1999


David Sheckler wrote:

> ShortIntegerIndex = *(short *)CharacterIndex; So, if my original value
> in CharacterIndex is 0x003b. It is cast into ShortIntegerIndex as
> 0x00003b00. I assume the = operator copied the value in from left to
> right, where as the sparc compiler copied it right to left filling the
> rest with zeros, so it had 0x0000003b for ShortIntegerIndex. The
> original code assumed a 2 byte short. I would think the prefered
The original code is broken. The behaviour you are seeing is constsient with a
big endian system and a little endian system with 16 bit shorts and 8 bit
chars. All these are implementation `features' which can vary from one
compiler/os/cpu to another.

> If this was of no help at all and I'm full of shit, please don't
> hesitate to tell me so.
Sorry, I guess you know know...

nathan

-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk



More information about the Gcc-bugs mailing list