(Guy) HARRIS FLAME Re: SHORT vs. INT

Eric Schwartz group schwrtze at csd2.UUCP
Fri Sep 13 23:59:00 AEST 1985


/* csd2:net.lang.c / mjs at sfmag.UUCP (M.J.Shannon) /  9:26 am  Sep 11, 1985 */
> 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.

The C language guarantees only that "short" is no longer than "long".  There
is no guarantee of any width of "short", "int", or "long" other than that!
It does turn out that in most implementations, the underlying hardware gives
the compiler-writer a choice of 8-, 16-, 32-, and possibly 64-bit integers,
but there are notable exceptions: the Honeywell 6000 (since renamed, but I
no longer recall what the new name of that architecture is), the DECsystem
10 & 20, etc.  These machines don't have word sizes that are powers of 2
wide (in bits).  Rather, a word is 36 bits wide, a halfword is 18, and a byte
is just about any size you like (5, 6, 7, 8, 9 bits).  Folks who depend on
integral types having exactly some size write less portable code than folks
who depend on said types having at least some size.
-- 
	Marty Shannon
UUCP:	ihnp4!attunix!mjs
Phone:	+1 (201) 522 6063
Disclaimer: I speak for no one.
/* ---------- */



More information about the Comp.lang.c mailing list