bits in an int vs. long?

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Sat Oct 7 01:38:50 AEST 1989


In article <252BB03A.2AEC at drivax.UUCP>, frotz at drivax.UUCP (Frotz) writes:

|  It is my understanding that:
|  
|  	sizeof(char) < sizeof(short) < sizeof(long)
|  	sizeof(short) == 2
|  	sizeof(long)  == 4

Actually sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)

All of the sizeof are defined as being a minimum number of bits, or the
equivalent range I don't remember. I suspect that char could be the same
size as short if someone made a char large enough (16 bits min).

This from the bible according to St ANSI ;-)

  In some machines the sizeof short, int, and long are identical.
Extrapolate to unsigned everything and float/double, too.
-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.lang.c mailing list