From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kurt Roeckx To: Charles Wilson Cc: DJ Delorie , binutils@sources.redhat.com, cygwin@cygwin.com Subject: Re: [aida_s@mx12.freecom.ne.jp: A serious bug of "ld --enable-auto-import"] Date: Sun, 26 Aug 2001 12:27:00 -0000 Message-id: <20010826212657.A2350@ping.be> References: <3B8884F6.80708@ece.gatech.edu> <200108260530.BAA28221@envy.delorie.com> <3B888D76.6090102@ece.gatech.edu> <200108260613.CAA28557@envy.delorie.com> <3B891172.9000207@ece.gatech.edu> <200108261543.LAA06415@envy.delorie.com> <3B891E23.9090407@ece.gatech.edu> X-SW-Source: 2001-08/msg00614.html 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