mirror of
https://github.com/ioacademy-jikim/debugging
synced 2025-06-07 07:56:19 +00:00
25 lines
364 B
C
25 lines
364 B
C
#include <stdio.h>
|
|
#include <setjmp.h>
|
|
|
|
#define TRY do{ jmp_buf ex_buf__; if( !setjmp(ex_buf__) ){
|
|
#define CATCH } else {
|
|
#define ETRY } }while(0)
|
|
#define THROW longjmp(ex_buf__, 1)
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
TRY
|
|
{
|
|
printf("In Try Statement\n");
|
|
THROW;
|
|
printf("I do not appear\n");
|
|
}
|
|
CATCH
|
|
{
|
|
printf("Got Exception!\n");
|
|
}
|
|
ETRY;
|
|
|
|
return 0;
|
|
}
|