[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: not enough real programmers? (was Re: Byte Magazine: 18 Vintage issues, 1985-1986)



In article <37bc3e1f.819037@news.pandora.be>,
Luc Van der Veken <lucvdv@null.net> wrote:
>Chris Brown posted:
>> In article <37bb3ef9.24418394@news.shuswap.net>,
>> Gene Wirchenko <genew@shuswap.net> wrote:
>> >>Not really, just use unsigned longs.
>> >     I believe it would be a conforming implementation of C to have
>> >short, int, and long all be 16 bits.

>> Then I believe you believe wrong. :-)

>I may be wrong, but I believe you believe he believes wrong
>wrong.

>In C++, [the size of, for all] a char is smaller than or equal to
>a short, which is smaller than or equal to an int, which is
>smaller than or equal to a long (so a char and a long *can* have
>the same size) - and AFAIR C is generally less restrictive than
>C++.

>IIRC, this has been discussed here not so long ago.

The strict ordering is
	sizeof(char) <= sizeof(anything)
	sizeof(short) <= sizeof(int) <= sizeof(long)

But that's not all!  Each type must be able to represent a certain range
of values.  For 'short', that range is +/- 32,767.  For 'int', it is also
+/- 32,767.  For 'long', it is +/- 2,147,483,647, and you can't do that
without 32 bits.

-s
-- 
Copyright 1999, All rights reserved.  Peter Seebach / seebs@plethora.net
C/Unix wizard, Pro-commerce radical, Spam fighter.  Boycott Spamazon!
Will work for interesting hardware.  http://www.plethora.net/~seebs/
Visit my new ISP <URL:http://www.plethora.net/> --- More Net, Less Spam!