Re: How does C handle issues arising out of Endianness?
- From: Dave Thompson <david.thompson1@xxxxxxxxxxxxxxxx>
- Date: Wed, 03 Jan 2007 19:45:09 GMT
On 18 Dec 2006 08:28:19 GMT, Chris Torek <nospam@xxxxxxxxx> wrote:
In article <1166381259.013423.327050@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Indian.croesus@xxxxxxxxx <Indian.croesus@xxxxxxxxx> wrote:
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. <snip>
Fortunately, your bed comes apart, into three pieces: <snip>
At the other end, your friend will reassemble the bed while you
drive back to get more stuff. <snip>
Your friend, for some reason, believes that you delivered the
[pieces in a different order and reassembles obviously wrongly]
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.[%]) <snip>
It's a good thing you're the one driving; I'd hate to see what this
Turing-machine-brained friend does when faced with say a bent or
obscured traffic control sign. (Aside: I lived near Boston back about
1980 when the originally Californian law, allowing by default right
turn after stop at a red light if no traffic, was adopted -- or at
least its adoption 'encouraged' -- Federally as a gasoline saving
measure. So the city went around putting up 'no turn on red' signs
pretty much everywhere. One intersection near me was already signed
'no left turn' AND 'no right turn' and they added 'no turn on red'!)
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.)
If it and everything else in the same load is tied down adequately;
otherwise it may arrive in an arbitrary but substantial number of
pieces, none bed-shaped, and probably not reassemble-able at all. FWIW
_this_ problem rarely happens with userlevel computer data; although
it can and does occur in hardware, devices and systems mostly are
designed with error detection and correction features (parity, CRC,
LRC, VRC, EDC, ECC, etc.) which lead the program to see either (1)
correct data as sent/stored/whatever or (2) no data at all, sometimes
but not always with a more-or-less specific error indicator.
<snip rest>
- David.Thompson1 at worldnet.att.net
.
- Prev by Date: Re: if string is a number (beginner)
- Next by Date: Re: FTP client C source code
- Previous by thread: Re: if string is a number (beginner)
- Next by thread: Re: FTP client C source code
- Index(es):
Relevant Pages
|