🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9475

Re: Big, Little and Bi endians

#9475
From: john blackburn
Date: Fri, 09 Jul 2004 10:03
26 lines
2164 bytes
<Donut> wrote:

> Questions :
>     How to check in C++ program if our applciation running on a
> Big/Little/Bi Endian machine?
>     Is there a generic way of transforming data (which could be in any
> structure) between different endians?

Others will know much better than myself as to how you can detect the endian
of the machine you are executing in: best to wait for more replies on that.

I am writing from the perspective of a hardware engineer; one of the
projects I worked on was providing conversion in hardware between multiple
processors of differing endian.  Maybe the technology has moved on with
specialized protocols for this purpose that I don't know about, but :-

There are two main issues with moving data between endian's: firstly
preservation of canonical byte ordering of strings and secondly,
preservation of integer integrity (and other numeric types).  If the
process of conversion is unaware of the structure of data passed, then one
or the other of these can be preserved but not both.  This is because the
processor can arbitarily read locations in byte or word mode.

To preserve both you will need to be fully aware of the exact structure of
the data passed and write a dedicated conversion of your own to convert
each data item according to type.  
Technical Details
Message-ID: <40ee6d71@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40ee62ed$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e4fd0ef684fef580
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Message-ID: <40ee6d71@newsgroups.borland.com>
From: john blackburn <john.blackburn@lintonhealy.co.uk>
Subject: Re: Big, Little and Bi endians
Newsgroups: borland.public.cppbuilder.nativeapi
Date: Fri, 09 Jul 2004 11:03:30 +0100
References: <40ee62ed$1@newsgroups.borland.com>
Lines: 26
User-Agent: KNode/0.7.2
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
NNTP-Posting-Host: 82.68.81.225
X-Trace: newsgroups.borland.com 1089367409 82.68.81.225 (9 Jul 2004 03:03:29 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail