Keith Thompson said:
Richard Heathfield said:
Eric Sosman said:
Richard wrote On 09/19/07 12:54,:
[...] in what
cases are &msg[0] and msg not the same in real live systems where they
are 32 or 64 bit pointers?
In all cases.
Not so. &msg[0] and msg are identical when their value is used in an
expression.
When their value is used, yes, but the question was whether they're
the same in general.
Um, no, the question was: "in what cases are &msg[0] and msg not the same
in real live systems where they are 32 or 64 bit pointers?"
Clearly the pointer-size thing is of no interest to comp.lang.c, since the
cases where &msg[0] and msg are the same or not the same is nothing to do
with pointer size as far as we're concerned. So it resolves to: "in what
cases are &msg[0] and msg not the same?" Nothing in there about "in
general". Eric's answer to this (which he acknowledges is based on a
misreading of what is probably a typo!) was "in all cases", which is
clearly not correct, because there is a case where &msg[0] and msg are the
same.
(The sizes of pointers are irrelevant.)
Agreed.
When they're the operand of a sizeof operator, their values are not
used, but they differ. Likewise for the operand of unary "&"
(but as has been pointed out, '&&msg[0]' is a constraint violation).
Yes, there are indeed cases where they differ, but "in some cases" != "in
all cases".