[net.lang.c] how is size of unsigned int defined?

lizh@athena.UUCP (Liz Heller) (12/20/84)

******

Does anyone know if unsigned int is defined to be the same size as
long int, or int?  I couldn't find this in Kernighan and Ritchie.

Liz Heller

graham@orca.UUCP (Graham Bromley) (12/20/84)

> Does anyone know if unsigned int is defined to be the same size as
> long int, or int?  I couldn't find this in Kernighan and Ritchie.

    An unsigned int is what it says: an unsigned int. There is also
an unsigned short and unsigned long (or unsigned short int and
unsigned long int if you like). Some implementations also have
an unsigned char for byte sized unsigned integers.
    An unsigned int may actually be the same size as an unsigned long
(e.g. on a VAX, both 32 bits) or as an unsigned short (e.g. on a 
PDP11, both 16 bits). But an unsigned object is always by definition
the same size as its signed counterpart.

    gbgb aka the longjmp artist

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (12/21/84)

> Does anyone know if unsigned int is defined to be the same size as
> long int, or int?

"unsigned" does not change the size of an integral type,
so	sizeof (unsigned int) == sizeof (int)	.

isis@utzoo.UUCP (n) (12/27/84)

An unsigned int is the same size as an int.  I use unsigned as type
prefix, where it modifies the context that the unit of storage (char,
int, long) is viewed.  This is consistent with the K & R definition
of unsigned as a type specifier (pp. 193).

Bill Mclean allegra!utzoo!isis		@ MOH 964-1983 or 965-0981

blufox <@csnet-relay.arpa,@ucsc.CSNET (blufox):blufox@ucsc.CSNET (01/08/85)

"A Book on C" by Al Kelley and Ira Pohl, Benjamin/Cummings, 1984,
gives a good description of this in Chapter 3.
In general, this book describes in considerable detail
the finer points of C, as well as all the standard material
concerning the language.

Have you seen it?