Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory errors when handling an exception within a function

Status
Not open for further replies.

cadbilbao

Programmer
Apr 9, 2001
233
ES
Hello.

I've got a function and I want to handle exceptions within it.
If I handle exceptions within 'main', there are no errors,
but if I try it within my_function, I get memory errors.

---------------//------------
void my_function() {
...
if (x > 0) {
int exception_local;
exception_local = 1002;
throw(exception_local);} //I get here memory errors
}

//main:

try {
...
if (!fileIN){
int exception_local;
exception_local = 1001;
throw(exception_local);} //I do not get any memory error
...
externalfunction()
...
}
catch(int exception_local) {
my_exception = exception_local; }

------------//--------------

What am I doing wrong?

Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top