??C???????C++???????????
???????????? ???????[ 2012/11/20 9:38:04 ] ????????
??????????c???????????У??????????????????????????ε???????????????????úü???if?????????????
if (xxx)
{
if(xxx)
{
}
else
{
return ERR_NO;
}
}
???????????????÷??????????????????????????????c++?????????????????????????????????c?????????????????????????????
????????c??????????????????е?????б??????????????????????????????????????Id????????????
?????·??
????????????????#define????c??????е??????????????try??catch??throw????????????return??break????c??????????е????????????????????????汾??
#ifndef EXCEPTION_H
#define EXCEPTION_H
// ??????????exception????
typedef unsigned int ERR_TYPE;
#define NO_ERR 0
static ERR_TYPE err; //try-catch-throw?????????
#define try do
#define catch(N) while(0);if(N>=NO_ERR)
#define throw(N) err=N;break;
#define throwAgain(N) err=N;return;
#endif
???????????????
void f(void)
{
try
{
throw(6);
}
catch(err)
{
throwAgain(err);
}
}
int main()
{
try
{
f();
}
catch(err)
{
printf(“%d”?? err);
}
}
??????
???·???
??????????????????
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