finally-1.m

来自「linux下编程用 编译软件」· M 代码 · 共 60 行

M
60
字号
#include <objc/Object.h>#include <stdio.h>#include <stdlib.h>static int made_try = 0;intthrower_try_body(){  made_try++;  return (0);}static int made_finally = 0;intfinally_body(){  made_finally++;  return (0);}intthrower(){  @try  {    thrower_try_body();    @throw [Object new];  }  @finally  {    finally_body();  }       return 0;}static int made_catch = 0;int main(int ac, char *av[]){  @try  {    thrower();  }  @catch (id exc)  {    made_catch++;    [exc free];  }  if (made_try != 1)    abort ();  if (made_finally != 1)    abort ();  if (made_catch != 1)    abort ();  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?