pete said:
Richard Heathfield wrote:
>>
Peter Nilsson said:
Ioannis Vranos <ivra...@nospam .no.spamfreemai l.grwrote:
#include <stdio.h>
int main()
{
unsigned x= -1;
int INTMAX=x /2;
What if UINT_MAX == INT_MAX,
I don't think it can.
It can.
sizeof(int) == 2
sizeof(unsigned ) == 2
CHAR_BIT == 16
INT_MAX == 0xffff
UINT_MAX == 0xffff
"The range of nonnegative values of a signed integer type is a subrange of
the corresponding unsigned integer type, and the representation of the
same value in each type is the same."
Since, in your example, int has 16 value bits, and since there must also be
a sign bit, that makes 17 bits altogether that contribute to the value. I
could be wrong, of course, but doesn't that mean that unsigned int must
also have 17 bits that contribute to the value?
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999