In article <11**********************@80g2000cwy.googlegroups. com>
In************@gmail.com <In************@gmail.comwrote:
If I am right Endianness is CPU related.
Others have already discussed most of the practical issues. I would
like to point out that endianness is not really "CPU related" at all
though.
Suppose you are getting ready to move from one apartment to another.
Your friend has offered you *free* use of his small pickup truck,
so that you need not rent a huge van.
There is one problem: your bed will not fit, fully assembled, into
the pickup.
Fortunately, your bed comes apart, into three pieces: headboard,
middle section, and footboard. Each of those pieces will, by
itself, fit in the truck. So you take the bed apart:
||||
|||| |||
|||| ============= |||
|||| ============= |||
headboard middle section footboard
At the other end, your friend will reassemble the bed while you
drive back to get more stuff. You bring him the headboard, then
the footboard, then the middle, because that was the easiest way
to take them out:
||||
|||| |||
|||| ||| =============
|||| ||| =============
Then you drive back to your old place to get more stuff.
Your friend, for some reason, believes that you delivered the
footboard first, then the middle, then the headboard. So he connects
the pieces in that order. But you delivered the footboard first,
so he put that where the headboard goes, then you delivered the
footboard, which he put in the middle, and last, you delivered the
middle, which he put at the foot:
||||
|||||||
=============|||||||
=============|||||||
Your bed is no longer use-able, until you take it apart and
re-reassemble it in the correct order. The problem is that you
and your friend failed to agree on "endianness". (Well, that, and
your friend is about as smart as a typical computer: he only does
what you tell him, instead of what you meant.[%]) But there is no
CPU in sight. So where did the "endianness" come from?
It came from disagreement between various entities -- in this case,
you and your friend -- that dis-assembled something (here, your
bed), then re-assembled it, but did not connect the same pieces in
the same way. To avoid the problem, you must make sure that all
entities involved in disassembly and reassembly agree as to which
sub-parts go where.
If you (and of course your friends too) never break a whole object
up into parts, the problem never occurs. (Transport the bed as a
single unit, it arrives as a single unit, still in "bed" shape.)
The problem occurs only when you *do* break something into parts.
Even then, it occurs only if you put it back together in some other
way. If you and your friends can all agree on some basic,
un-break-able sub-unit -- such as, say, the 8-bit byte -- and you
make sure never to give out anything "too big" so that your friends
have to break them up, *you* can control the order of breaking-up
and re-assembling, and therefore guarantee that the re-assembly
always follows the same sequencing rules as the breaking-up.
-----
[%] The student programmer's lament:
I really hate this darn* machine
I wish that they would sell it
It never does quite what I want
But only what I tell it.
* or other suitable one-syllable word
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.