Mail Archives: djgpp/1999/04/13/22:15:32

From: Chris Jones <chris DOT jones AT ucl DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: SIGSEGV problem with DJGPP (deleting array)
Date: Wed, 14 Apr 1999 01:35:57 GMT
Organization: Deja News - The Leader in Internet Discussion
Lines: 29
Message-ID: <7f0rdt$3vn$>
References: <7f0g7a$qg7$1 AT nnrp1 DOT dejanews DOT com> <199904132318 DOT TAA05382 AT envy DOT delorie DOT com>
X-Article-Creation-Date: Wed Apr 14 01:35:57 1999 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)
X-Http-Proxy: 1.1 (Squid/1.1.22) for client
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <199904132318 DOT TAA05382 AT envy DOT delorie DOT com>,
  djgpp AT delorie DOT com wrote:
> >         double *ptr2= new double [size+1];
> >	  ...
> >         delete [] ptr;
> I hope you meant ptr2 here.
> >         double *ptr=new double [size];
> >	  ...
> >         delete [] ptr2;
> I hope you meant ptr here.

I don't think so (or at least I hope not). The idea is to increase the size
of the array ptr by one, so I copy to a dummy array, delete ptr and recreate
it with a new, larger size. Then copy the old contents across from the dummy
array and delete it.

I am quite new to this however :)

Chris Jones

"Everybody who believes in psychokinesis, raise my right hand"

-----------== Posted via Deja News, The Discussion Network ==----------       Search, Read, Discuss, or Start Your Own    

- Raw text -

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