delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/21/06:00:45.1

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: problems with new
Date: 21 Aug 2000 09:56:17 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 23
Message-ID: <8nquc1$d3i$1@nets3.rz.RWTH-Aachen.DE>
References: <8nkfqr$hhj$2 AT info DOT cyf-kr DOT edu DOT pl>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
Mime-Version: 1.0
X-Trace: nets3.rz.RWTH-Aachen.DE 966851777 13426 137.226.32.75 (21 Aug 2000 09:56:17 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 21 Aug 2000 09:56:17 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Rafał Maj" <r_maj AT poczta DOT onet DOT pl> wrote:

> #2 char *ptr = new[100*1024*1024];
>      OR, what I realy need :
>      MyClass *ptr = new MyClass( var1, var2);
>      If ther isn't free memory, that cause program to crash with :

> Call frame traceback:
> in function __djgpp_traceback_exit+48
> in function raise+94
> in function abort+27
[...]

You should get yourself a good C++ textbook, if you don't have one
yet, and read up on exceptions in C++, and how 'new' throws one if
there is not enough memory. You're supposed to catch that exception to
take care of this situation.



-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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