🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.comp.lang.c++
Article #1134

BC++4.5 new-operator & xalloc

#1134
From: Erwin Tenhumberg
Date: Thu, 28 Dec 1995 17:36
39 lines
1198 bytes
Hello C++-Programmers!

I have a problem with using the C++ exeption handling in connection 
with the new operator.
The following small programm (compiled as a standard DOS program,
standard project options, Borland C++ 4.5 german version) supplies the
output 'Abnormal program termination' instead of showing the Message 
'Out Of Memory!'.
Who can tell me, what I have to do, so that I'll get the correct output?

Yours,
Erwin Tenhumberg


MY_PROGRAM:

#include <except.h>
#include <iostream.h>
#include <stdlib.h>

void main()
{
	char *reserve new char[500];
	char *buffer;

	try
	{
		for (int i; i<200; i++)
		{
			buffer new char[10000];
		}
	}
	catch(xalloc)
	{
		delete [] reserve;
		cout << "Out Of Memory!" << endl;
		exit(5);
	}
}
Technical Details
Message-ID: <4buo33$pui@news00.btx.dtag.de>
Path: arc1-ca.pugleaf.net!news00.btx.dtag.de!not-for-mail!0256497811-0001

Show Full Headers
Complete Article Headers
Newsgroups: de.comp.lang.c++
Message-ID: <4buo33$pui@news00.btx.dtag.de>
From: 0256497811-0001@t-online.de (Erwin Tenhumberg)
Path: arc1-ca.pugleaf.net!news00.btx.dtag.de!not-for-mail!0256497811-0001
Subject: BC++4.5 new-operator & xalloc
Date: Thu, 28 Dec 1995 17:36:19 +0000
X-Gateway: ZCONNECT XX ius.gun.de [UNIX/Connect v0.73]
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit