sizeof (integral types)
Guy Harris
guy at auspex.auspex.com
Fri Apr 21 15:56:16 AEST 1989
>Nothing in C or C++ is _guaranteed_ about sizes except
> 1 == sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long).
Possibly true of C++ and of pre-ANSI C; however, once the standard is
approved and compilers start claiming conformance, anybody who claims
that their compiler conforms but whose compiler doesn't have:
a "char" type that holds values between -127 and 127;
an "unsigned char" type that holds values between 0 and 255;
a "short" or "int" type that holds values between -32767 and
32767;
an "unsigned short" or "unsigned int" type that holds values
between 0 and 65535;
a "long" type that holds values between -(2^31-1) and (2^31-1);
an "unsigned long" type that holds values between 0 and (2^32-1);
is lying.
More information about the Comp.lang.c
mailing list