Bonjour à tous,

peut on catcher un stack overflow comme sur cette exemple (qui ne marche pas) ?


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
void test8()
{
	try
	{
		int i = 0;
		test9(i);
	}
	catch(const exception &e)
	{
		cout << e.what() << endl;
	}
}
 
void test9(int &i)
{
	i++;
	test9(i);
}
 
int main()
{
	test8();
	return 0;
}

On m'a envoyé ce lien : http://gcc.gnu.org/onlinedocs/libstd....6/a00469.html et je vois qu'il y a une exception correspondante (overflow_error), comment fait on pour la catcher ?

merci d'avance.