Byte order (retitled)

Stanley Friesen friesen at psivax.UUCP
Thu Apr 17 07:33:14 AEST 1986


In article <7158 at cca.UUCP> g-rh at cca.UUCP (Richard Harter) writes:
>>
>>Many implementors of C on big-endian machines have had to cope with
>>the pointer conversion problem, which is simpler on little-endians.
>>
>	Color me skeptical.  You may be right, but I would like to
>	see more details.  In the model of pointers that it occurs
>	to me to implement, big-Endian and little-endian come out
>	the same.

	Could you expand on this! Do you mean that if you cast a
pointer to a long to a pointer to a short and dereference you will get
the *high* order portion on a big-endian machine and the *low* order
portion on a little-endian? Clearly a portability problem, and the the
big-endian behavior is counter-intuitive. Or do you intend that the
pointer always point to the low-order byte even on a big-endian
machine? Then you have to index *backwards* to break the item up into
bytes! Really, the only way to get the rigth semantics on a big-endian
machine is to actually convert pointers when a cast is used.
-- 

				Sarima (Stanley Friesen)

UUCP: {ttidca|ihnp4|sdcrdcf|quad1|nrcvax|bellcore|logico}!psivax!friesen
ARPA: ttidca!psivax!friesen at rand-unix.arpa



More information about the Comp.lang.c mailing list