Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site cyb-eng.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!ut-sally!cyb-eng!bc From: bc@cyb-eng.UUCP (Bill Crews) Newsgroups: net.lang.c Subject: Re: Uses of "short" ? Message-ID: <696@cyb-eng.UUCP> Date: Tue, 10-Sep-85 14:45:29 EDT Article-I.D.: cyb-eng.696 Posted: Tue Sep 10 14:45:29 1985 Date-Received: Thu, 12-Sep-85 10:13:20 EDT References: <486@houxh.UUCP> Organization: Cyb Systems, Austin, TX Lines: 25 > What are the reasons for using the type short in C ? On > machines that have a different size for "int" and "short" > the reason seems obvious, space. However, I would appreciate any thoughts > on there usefulness there also. Specifically, I am interested > in its use on machines where sizeof (int) = sizeof (short). > > Thx The percentage of machines in the universe that are either 16-bit or 32-bit machines is very highgh. Therefore, one can get a great degree (but certainly not total) compatibility of communicated information by refraining from declaring ints in structures, but instead declaring either shorts or longs. All compilers for such machines of which I am aware implement short as 16 bits and long as 32 bits, although the definition of int may go either way. So, for my data files and communications protocols, this is what I do. If I run into a 36-bit or 48-bit machine, I may have some work to do. By the way, the uint16-type stuff mentioned lately on the net can help here also. -- / \ Bill Crews ( bc ) Cyb Systems, Inc \__/ Austin, Texas [ gatech | ihnp4 | nbires | seismo | ucbvax ] ! ut-sally ! cyb-eng ! bc