Ma************@web.de wrote:
[...]
Thus, the value of a const-qualified pointer to some object is
equal to the value of an unqualified pointer to the same object.
It's possible that the representation could be different
(do not mis-read 6.2.5/25 as prohibiting this), but '=='
must hold.
How can a representation be different and manage the same object here?
What is the difference that can be recognized by the relational
operators or the function "memcmp"?
It is possible for different representations of a type
to correspond to the same value as determined by `=='. The
floating-point types offer a familiar example, since there
are two different representations of the value zero; there
may also be different "unnormalized" representations of some
numbers. Identical representations usually imply equality
(an exception is NaN), but equality does not imply identical
representation.
As for pointers -- well, a certain widely-used architecture
supports a "segment plus offset" addressing scheme that can
address the same location with many segment/offset pairs. Or
imagine a system with (say) 48-bit addresses in 64-bit pointers;
the 16 extra bits might not participate in pointer comparisons
at all. They might even carry flags for attributes like `const'
or "obtained from malloc()" or the like, which could be useful
for debugging and validation even if they didn't contribute to
the pointer's value.
--
Eric Sosman
es*****@acm-dot-org.invalid