Date: Sat, 17 Mar 2001 09:55:42 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Sahab Yazdani Message-Id: <4331-Sat17Mar2001095541+0200-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 CC: djgpp AT delorie DOT com In-reply-to: <3AB2BCD3.4020002@operamail.com> (message from Sahab Yazdani on Fri, 16 Mar 2001 20:24:35 -0500) Subject: Re: the follies of new... References: <3AB2BCD3 DOT 4020002 AT operamail DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Sahab Yazdani > Newsgroups: comp.os.msdos.djgpp > Date: Fri, 16 Mar 2001 20:24:35 -0500 > > void foo() { > bar = new bar(); > fprintf( stderr, "bar[afterinit]: %x\n", bar ); > > fprintf( stderr, "bar[beforedestruct]: %x\n", bar ); > delete bar; > } > > the strangeness is that the first time this function is called I get > this (these are actual results of my program, obvoisly using function > foo as an example): > > bar[afterinit]: 0x45eb8 > bar[ondestruct]: 0x45eb8 > bar[oninit]: 0xff4f31f0 > bar[ondestruct]: 0xff4f31f0 > SIGSEGV afterwards > > this shows that the pointer doesn't shift, so the code is okay, but the > address of the second set of pointers points to memory in the 4GB > region, which my computer doesn't have (although I wish it did :-)). You didn't say what does the bar's constructor do. I'm guessing that the key to unlock this is there.