Are there any particular C rules saying that types
long, int and
char must be integral multiples of one another.
(I'm assuming that's a question, despite the non-question punctuation.)
Only in that everything must be made up of chars.
For instance, could one have a char of 16 bits, an int
of 21 bits and
a long of 29 bits?
Sort of.
You could have a char of 16 bits, an int of 21 significant and 11
insignificant bits, and a long of 29 significant and 3 insignificant
bits.
You could not have an int made up of one and five-sixteenths chars;
everything must be made up of an integral number of chars. (Well,
every object must be. There are a very few things that might be
non-objects, though that area is not entirely clear to me.)
Pointers really are the poison in C and drives
automatic optimizers
crazy. But then, perhaps C was never intended to be automatically
optimized.
Only sort of. C was designed as an OS implementation language. There
are places where this means you really really don't want optimization;
C has grown things like `volatile' to give coders a way to tell the
optimizer to butt out when necessary. (There are other places where
you do want optimization, even when writing OSes and certainly when
writing lots of other kinds of code. Arguably using C for other things
is a misuse of the language, but, misuse or not, that ship sailed a
_long_ time ago.)
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse at
rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B