Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!tgr!bilbo.niket@LOCUS.UCLA.EDU From: bilbo.niket@LOCUS.UCLA.EDU (Niket K. Patwardhan) Newsgroups: net.lang.c Subject: Re: Re: Uses of \\"short\\" ? Message-ID: <2293@brl-tgr.ARPA> Date: Mon, 21-Oct-85 14:50:44 EDT Article-I.D.: brl-tgr.2293 Posted: Mon Oct 21 14:50:44 1985 Date-Received: Wed, 23-Oct-85 04:50:06 EDT Sender: news@brl-tgr.ARPA Lines: 46 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). Without being able to specify exactly how many bits you want to use, porting programs between machines with different ideas of what an int, long, short or char is can be real painful. NOTE even "char" is not sacred, KL10s can define them as any number of bits upto 36(!!) with 6, 8 and 9 being values that support various types of TOPS-10 (their OS) characters. What I would really like to see is that the bit-field semantics be changed a little. struct x { unsigned a:18; unsigned b:18; unsigned c:36; } should be packed together as close as possible, taking up 9 bytes (octets), rather than the 4+4+5 it takes up on a 16-bit word machine, or the 4+4+8 bytes it takes up on a 32-bit machine. If you wanted it to be the way it is today you would define it as struct x { struct { unsigned a:18; }; struct { unsigned b:18; }; struct { unsigned c:32; }; } In addition, there would be no harm done if unsigned a:13; were allowed as a declaration. BTW, can somebody give me the correct address to reach everybody in net.lang.c and std.c. I suspect the ones I am using reach only a small subset of the people in these groups.