At 7:35 pm -0800 2012/01/31, Chuck Guzis wrote:
For example, a machine with 128-bit words, and only
addressable by
word addresses doesn't need to have type char as 128 bits, only that
the compiler and run-time need to make provision for some means of
addressing chars, even if that means a separate system of addressing;
e.g. "C" addresses are machine addresses shifted by 4 bits.
I suppose it's even possible to create a C where word addresses ==
char addresses; the char being aligned in a word, one char per word,
with the remainder of the word unsued.
So does the difference between two void* pointers necessarily equate
to a count of chars between those addresses?
Yes. "A pointer to void shall have the same representation and alignment
requirements as a pointer to a character type." Pointers to other types are
not required to have the same representation, but it is necessary to be
able to convert to a void* and back without losing information.
Do char and int addresses have to share the same space?
Yes, because a union of a char and an int is possible.
Do addressing spaces need to be compatible? (I think
about
low-end PIC 8-bit and AVR where data stored in code space as
constants don't have the same granularity.
That's a separate question, which is mostly covered in a separate technical
report TR 18037. The standard does allow pointers to two different objects
to have the same value, and therefore be distinguished only in some other
way, e.g. TR 18037 address space.
--
Kevin Schoedel <schoedel at kw.igs.net> VA3TCS