64 bit architectures and C/C++

david at ap542.uucp david at ap542.uucp
Wed May 15 16:12:53 AEST 1991


-cadsi at ccad.uiowa.edu (CADSI) writes:
->by rli at buster.stafford.tx.us (Buster Irby):
->> cadsi at ccad.uiowa.edu (CADSI) writes:
->> 
->>>Binary isn't in general portable.  However, using proper typedefs in
->>>a class one can move binary read/write classes from box to box.  
->> 
->> What kind of typedef would you use to swap the high and low bytes
->> in a 16 bit value?  An Intel or BIG_ENDIAN machine stores the
->> bytes in reverse order, while a Motorolla or LITTLE_ENDIAN
->> machine stores the bytes in normal order (High to low).  There is
->> no way to fix this short of reading the file one byte at a time
->> and stuffing them into the right place.  
->
->The big/little endian problem is handled via swab calls.
->AND, how do we know when to do this????  We just store
->the needed info in a header record.

NO, NO, NO!  The way to do this is to use XDR.

**========================================================================**
David E. Smyth
david%ap542 at ztivax.siemens.com	<- I can get your mail, but our mailer
				   is broken.  But I can post.  You figure...
**========================================================================**



More information about the Comp.lang.c mailing list