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!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!genrad!panda!talcott!harvard!seismo!brl-tgr!tgr!jeff@ISI-VAXA.ARPA From: jeff@ISI-VAXA.ARPA (Jeffery A. Cavallaro) Newsgroups: net.lang.c Subject: Re: HARRIS FLAME Re: SHORT vs. INT Message-ID: <1390@brl-tgr.ARPA> Date: Mon, 9-Sep-85 13:12:00 EDT Article-I.D.: brl-tgr.1390 Posted: Mon Sep 9 13:12:00 1985 Date-Received: Wed, 11-Sep-85 07:43:24 EDT Sender: news@brl-tgr.ARPA Lines: 37 What Mr. Harris meant to say (he didn't say it too well) was the following: "short" and "long" are generic "int" types that should be used whenever a general purpose integer value is required. These types are meant to provide compatability on two levels: 1. PORTABILITY The ability to port code between different machine types and operating systems that support C. 2. NETWORK COMMUNICATION To enable network communication between different machines, a "short" is guaranteed to be 16-bits and a "long" is guaranteed to be 32-bits. This is either convention or standard, I am not sure which. If anyone knows if this is a printed standard, I would appreciate them sending me a message with the reference. When sending data over a network, the "byteorder(3N)" routines should be used to convert machine-dependant "short" and "long" types to a network standard byte order. When receiving these types, one should convert back to the machine-dependent forms. By the way: WHOLE STRUCTURES SHOULD NEVER BE TRANSMITTED OVER A NET DUE TO BYTE ORDER AND ALIGNMENT PROBLEMS. In contrast, the "int" type is a very machine-dependent type. It is made equivalent to a machine's natural word size. This type is needed if C is going to make any claims about being an "operating system capable" language. FLAME OF MY OWN: People such as Mr. Harris should be aware that not all people participating in this forum are experts. The question was a valid one, and deserved a reasonable response, not a better-than-thou dissertation. Such responses just intimidate people who might otherwise benefit by asking questions of this type. Jeff