delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/21/14:09:42

X-Spam-Check-By: sourceware.org
Message-ID: <fb34b27b0608211109i2685b9c8jed5b815a8cb16223@mail.gmail.com>
Date: Mon, 21 Aug 2006 19:09:27 +0100
From: "Mark Fisher" <mark DOT j DOT fisher AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: problem with malloc/realloc. Pls help.
In-Reply-To: <loom.20060821T171635-299@post.gmane.org>
MIME-Version: 1.0
References: <loom DOT 20060821T171635-299 AT post DOT gmane DOT org>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 8/21/06, Omololu wrote:
> Hi,
>  i have the following code. it compiles with gcc in Cygwin but the contents of
> the array ifitQ that I get after the call to the subroutine readCharges2 is
> gibberish.

looks like a passing by reference problem. if you add debug to look
at the address of ifitQ at all stages, you'll notice that the copy pointer
in readCharges2 gets changed, but that isn't the same pointer as in
the calling block.

see section 2.17 of http://www.lysator.liu.se/c/c-faq/c-2.html

i don't understand how linux is getting it right tbh.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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