www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/25/13:06:07

Date: Thu, 25 Jan 96 19:30 MET
From: jae AT Laden1 (Juergen Erhard)
To: 5709kelnhofe AT vmsa DOT csd DOT mu DOT edu
CC: djgpp AT delorie DOT com
In-reply-to: <0099CD07.29EC49B7@vms.csd.mu.edu> (5709kelnhofe@vmsa.csd.mu.edu)
Subject: Re: Dyn Mem Allocation using new and delete in dgjpp g++

   Richard W. Kelnhofer wrote

   I created a class in c++ to implement interval numbers and vectors
   of interval numbers.  The vector class uses new and delete in
   the constructors and destructors to allocate and deallocate memory
   from the free store.  This works well on most platforms.  However,
   I was getting segmentation violations when running code compiled
   with djgpp on a PC.  I solved the problem by placing the implementation
   code for the constuctors and destructors inside the class definitions.

   I was curious if this is normal or if anyone has had similar experiences?


Well, I almost never put code inline in the class definition. So I
often use new/delete in the constructor, and I never ran into problems
(yet).

So, what version of DJGPP did you use? What was the gcc version? What
was the actual code?

I used gcc 2.6.0 (on OS/2), 2.6.0 and 2.6.3 (DJGPP on DOS) and 2.7.0
on Linux, and no problems of this kind...

-- 
Juergen A. Erhard
eMail: jae AT laden DOT ilk DOT de
snailMail: Juergen Erhard
           Belfortstr. 6
           76133 Karlsruhe
           GERMANY
phone: (+49) (0)721/27326

- Raw text -


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