This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [aida_s@mx12.freecom.ne.jp: A serious bug of "ld --enable-auto-import"]
On Sun, Aug 26, 2001 at 12:04:51PM -0400, Charles Wilson wrote:
>
> Since arrays ARE pointers
They are NOT the same. The only place you can change an array
into a pointer is in a function call, because that is how an
array is passed to a function. You can also do the same
arithmetic with pointers as you can with arrays.
To put it simple, an array allocates storage for data, while the
pointer allocates storage to hold the pointer. You need to make
the pointer point to allocated storage.
There are other differences, like a pointer has a modifiable
lvalue, and an array hasn't.
It also generates different code when you derefence a pointer or
array. With an array, it starts at the addres of the array, and
adds to that, while with a pointer it first has to get the
address it points to, and add to that.
Kurt