C++ Code Optimization

C++ Code Optimization

Postby MC » Thu May 22, 2008 5:58 am

User avatar
MC
 
Posts: 7
Joined: Sat Feb 17, 2007 12:58 am
Location: Singapore

Postby admin » Wed Jan 27, 2010 2:25 pm

Catching stack overflow



#include <iostream>

#include <windows.h>



using namespace std;



int F(int a)

{

return F(a);

}



void main()

{

__try

{

// Recursive call



F(10);

}

__except(GetExceptionCode() == EXCEPTION_STACK_OVERFLOW? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)

{



cout<<"stack overflow error"<<endl;



}

}
admin
Site Admin
 
Posts: 237
Joined: Thu Dec 07, 2006 4:03 pm
Location: Amsterdam, The Netherlands


Return to C++

Who is online

Users browsing this forum: No registered users and 1 guest

cron