Re: Address of an array = address of its 1st element: undecidable question ?
- From: Peter Nilsson <airia@xxxxxxxxxxx>
- Date: Thu, 22 May 2008 19:00:16 -0700 (PDT)
Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
candide said:
I try to find out what exactly means "an array and
its address are the same"
They aren't. An array is an array. An address is a
pointer value. These are not the same thing. If you
mean that &array and &array[0] are the same,
they aren't. They have different types.
or "have the same value".
If you try to take the value of an array, what you
actually get is the value of a pointer to the first
member of the array. That doesn't mean that an array
is the same as a pointer. If you mean that &array
and &array[0] have the same value, they don't. They
have different types.
What about (void *) &array == (void *) &array[0]?
Everybody seems to agree that they doesn't share
the same type, of course.
And therefore they cannot have the same value.
So 1 is _not_ the same value as 1u?
Can you then tell me what the standard means when
it says...
"The range of nonnegative values of a signed
integer type is a subrange of the corresponding
unsigned integer type, and the representation
of the same value in each type is the same."
^^^^^^^^^^
Either 'same value' is independant of type, or
above line makes no sense. Which is it?
--
Peter
.
- Follow-Ups:
- Re: Address of an array = address of its 1st element: undecidable question ?
- From: Chris Torek
- Re: Address of an array = address of its 1st element: undecidable question ?
- From: Richard Heathfield
- Re: Address of an array = address of its 1st element: undecidable question ?
- From: CBFalconer
- Re: Address of an array = address of its 1st element: undecidable question ?
- From: pete
- Re: Address of an array = address of its 1st element: undecidable question ?
- References:
- Address of an array = address of its 1st element: undecidable question ?
- From: candide
- Re: Address of an array = address of its 1st element: undecidable question ?
- From: Richard Heathfield
- Address of an array = address of its 1st element: undecidable question ?
- Prev by Date: Re: memfrob and strfry ? OT
- Next by Date: Re: Address of an array = address of its 1st element: undecidable question ?
- Previous by thread: Re: Address of an array = address of its 1st element: undecidable question ?
- Next by thread: Re: Address of an array = address of its 1st element: undecidable question ?
- Index(es):
Relevant Pages
|