[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)



On Thu, 19 Aug 1999 18:15:26 GMT, seebs@plethora.net (Peter Seebach)
wrote:

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

The version that I read (can't remember which) said much the same
but without your first line. It read something like "a short must be
no greater than an int; an int must be no greater than a 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.

Are you sure about that ? A short has to be able to represent 32
bits ?! That would make things very inefficient on a 16- or 8-
bit processor. The primary reason for using "short" over "int"
is to save space (especially in arrays). If a short has to be
at least 32 bits, there seems little point in having it.

Richard [in CM8]