Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp
Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!decvax!decwrl!sun!guy
From: guy@sun.uucp (Guy Harris)
Newsgroups: net.lang.c
Subject: Re:  Re: Uses of \\"short\\" ?
Message-ID: <2934@sun.uucp>
Date: Sat, 26-Oct-85 18:15:29 EST
Article-I.D.: sun.2934
Posted: Sat Oct 26 18:15:29 1985
Date-Received: Mon, 28-Oct-85 04:17:17 EST
References: <2293@brl-tgr.ARPA>
Organization: Sun Microsystems, Inc.
Lines: 27

> It is particularly important when you are sharing data between machines with
> different integer models (ie. little endian vs. big endian). You then want
> "int16" to mean something very specific (16 bits in little endian format).
> I chose little endian because thats what most networks seem to use (as
> opposed to IBM or Motorola CPUs).

Aside from the fact that many networks don't use little-endian format (as
has been pointed out already), it's not appropriate to build data types with
specified byte orders into a programming language.  Many libraries exist
which put objects into a canonical byte order (the "ntoh" and "hton"
routines in 4.2BSD, the Sun XDR library, etc.).  These operations are only
used when data is exported (to a network connection or a file) or imported;
burdening the compiler with these data types, or burdening its object code
with the responsibility of reordering them on each reference, is a mistake.

Besides, there are other issues than just byte order - floating point
format, padding between structure members, etc., etc..  If you want a
language to specify this, consider putting it into something like a remote
procedure call description language, not in a general programming language.

> BTW, can somebody give me the correct address to reach everybody in
> net.lang.c and std.c.

I don't know whether any gateway exists between the ARPANET and "mod.std.c",
but all mail to the INFO-C mailing list should get gatewayed to "net.lang.c".

	Guy Harris