sizeof (integral types)

Guy Harris guy at auspex.auspex.com
Fri Apr 28 20:29:59 AEST 1989


>The above was given only as an example of how an ANSI compliant C
>could define these values, but why not make INT_MIN -32768?

To allow ANSI C to be implemented on machines with, say, 16-bit "int"s
and a one's complement or sign-magnitude representation of integral
types.

>In either case, I want to be able to access all possible values with
>my bits, regardless of whether or not my variable is signed.

Then don't buy one's complement or sign-magnitude machines.  The pANS
doesn't *require* that you be able to represent -32768 as an "int", but
it doesn't *forbid* it, either.  (What happens to "-0" on a one's
complement or sign-magnitude machine?)



More information about the Comp.lang.c mailing list