delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/26/15:27:33

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Sun, 26 Aug 2001 21:26:57 +0200
From: Kurt Roeckx <Q AT ping DOT be>
To: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
Cc: DJ Delorie <dj AT delorie DOT com>, binutils AT sources DOT redhat DOT com,
cygwin AT cygwin DOT com
Subject: Re: [aida_s AT mx12 DOT freecom DOT ne DOT jp: A serious bug of "ld --enable-auto-import"]
Message-ID: <20010826212657.A2350@ping.be>
References: <3B8884F6 DOT 80708 AT ece DOT gatech DOT edu> <200108260530 DOT BAA28221 AT envy DOT delorie DOT com> <3B888D76 DOT 6090102 AT ece DOT gatech DOT edu> <200108260613 DOT CAA28557 AT envy DOT delorie DOT com> <3B891172 DOT 9000207 AT ece DOT gatech DOT edu> <200108261543 DOT LAA06415 AT envy DOT delorie DOT com> <3B891E23 DOT 9090407 AT ece DOT gatech DOT edu>
Mime-Version: 1.0
X-Mailer: Mutt 1.0pre2i
In-Reply-To: <3B891E23.9090407@ece.gatech.edu>

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


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019