Thread View: de.comp.lang.c++
1 messages
1 total messages
Started by Erwin Tenhumberg
Thu, 28 Dec 1995 17:36
BC++4.5 new-operator & xalloc
Author: Erwin Tenhumberg
Date: Thu, 28 Dec 1995 17:36
Date: Thu, 28 Dec 1995 17:36
39 lines
1198 bytes
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);
}
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads