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!ron From: ron@brl-tgr.ARPA (Ron Natalie ) Newsgroups: net.lang.c Subject: Re: HARRIS FLAME Re: SHORT vs. INT Message-ID: <1392@brl-tgr.ARPA> Date: Mon, 9-Sep-85 14:40:07 EDT Article-I.D.: brl-tgr.1392 Posted: Mon Sep 9 14:40:07 1985 Date-Received: Wed, 11-Sep-85 07:49:02 EDT References: <1390@brl-tgr.ARPA> Organization: Ballistic Research Lab Lines: 30 > 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. Actually, it is neither. Assuming short is 16 and long is 32 will get you into problems. If you have a machine with a word size longer than 32, you have no recourse than to make your longs the length of the word size, as it is a standard that ints can't be longer than longs. Those of us who work on 36 and 64 bit machines are well aware of this problem. The network standard lists the exact bit representation using pictures, not related to any machine or language. HTONS and the other byteorder routines are used in 4.2 code to byte swap when necessary. They are not part of any standard or convention outside of the 4.2. Bit fields are another source of network problems as there is currently no standard for the order of bits in a group of fields. > By the way: WHOLE STRUCTURES SHOULD NEVER BE TRANSMITTED OVER A NET DUE > TO BYTE ORDER AND ALIGNMENT PROBLEMS. No matter what you transmit over the net you have to be careful and there always ends up being some machine dependance somewhere. There is no such thing as a network alignment problem. The network is a string of octets (that's eight bit things, can't say bytes because some people actually have different byte sizes). > FLAME OF MY OWN: > People such as Mr. Harris should be aware that not all people participating > in this forum are experts. You certainly aren't.