On 2/1/2012 12:27 AM, Eric Smith wrote:
On Tue, 31 Jan 2012, Chuck Guzis wrote:
Sort of. Are there any particular C rules saying
that types long,
int and char must be integral multiples of one another. For
instance, could one have a char of 16 bits, an int of 21 bits and a
long of 29 bits?
On 01/31/2012 09:48 PM, Fred Cisin wrote:
Absolutely.
Not in ISO C. All types have to be a multiple of the size of the char
type, which must be at least 8 bits. You could have
8-bit char, 24 bit
short, 40 bit int, and 48 bit long. You can't have a 21 bit int, unless
the char type is 21 bits, because 21 doesn't have any factor n such that
8 <= n < 21.
I would suspect what the standard needed to read was.
"Int's and long are 2^n characters wide, so that shifts can be
used to scale indexes and other pointer data as well as ease in
fetching non character data."
I like that idea, a nice 48/24 bit cpu with 8 bit characters. The only
problem is you have to do byte fetches, you cannot grab a words
worth of data at once.
I was looking at 'B' a few weeks ago, and that just requires a word
length (32?) 36 bits long. Characters are packed 4 to a word.
Ben.