??C???????C++???????????
???????????? ???????[ 2012/11/20 9:38:04 ] ????????
???????????????????????????????????????????????????try??
????????????????????????????????
Int main()
{
Try
{
f();
}
catch(err)
{
printf(“%d”?? err);
}
}
Void f()
{
G();
// some codes follows
}
Void g()
{
Throw(3);
}
??????g()throw????3?????main??????а?????????????????f()?????????????к?????????????????????????????????а??????
???????????????????????????????Goto?????????????goto??????????????????á?goto???????????????????????????????????????????????????????????????
??????????????????
#include
int setjmp(jmp_buf env)
Returns: 0 if called directly?? nonzero if returning from a call to longjmp.
void longjmp(jmp_buf env?? int val);
????setjmp ??longjmp??2??????????????????????????????????????????????????longjmp??????????ú??????????п?????!!
??????2??????????÷?????
#include
#include
jmp_buf ebuf;
void f2(void);
int main(void)
{
int i;
printf(“1”);
i=setjmp(ebuf);
if(i==0)
{
f2();
printf(“This will not be printed.”);
}
printf(“%d”??i);
return 0;
}
void f2(void)
{
printf(“2”);
longjmp(ebuf??3);
}
??????
![](/images/ad-banner/ad-banner.png)
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11