Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Тестовые примеры / ch4 / test_setjmp
.C /* source file name: test_setjmp.c */
#include <iostream.h>
#include <setjmp.h>
static jmp_buf loc;
int main()
{
int retcode, foo();
if ( (retcode=setjmp( loc )) != 0 ) { // error recovery
cerr << "Get here from longjmp. retcode=" << retcode << endl;
return 1;
}
/* normal flow of program */
cout << "Program continue after setting loc via setjmp...\n";
foo();
cout << "Should never get here ....\n";
return 1;
}
int foo()
{
cout << "Enter foo. Now call longjmp....\n";
longjmp (loc, 5);
cout << "Should never gets here....\n";
return 2;
}
Соседние файлы в папке ch4