C/C++ 信号处理抛异常, 报 terminate called after throwing an instance of 'int'

写了一个C的测试程序,目的是捕获进程产生的信号,然后通过信号处理函数处理后,抛出异常,回到catch块中。
但测试结果是,信号处理函数产生的异常对象,不能被catch收住

demo

#include<stdio.h>
#include<stdlib.h>
#include<signal.h>

void signal_catchfunc(int signal) {

   printf("get singal %d\n", signal);
   throw 10;
}

int main()
{
        int ret;
        signal(SIGSEGV, signal_catchfunc);
        try{
//              printf("begin\n");
                ret = raise(SIGSEGV);
                if(ret != 0){
                        printf("raise error\n");
                        return -1;
                }

        }catch(int e){
        printf("throw %d\n", e);
        }catch(...){
        printf(" type .... \n");
    }

      printf("exit\n");
      return 0;
}

执行结果是
get singal 11
terminate called after throwing an instance of 'int'
Aborted (core dumped)

这是为什么?求解

C++ 的try catch 只能接受主动throw出去的错误

信号回调应该是在其他地方被执行的,不是在你try catch块中被执行

C抛出的异常基本都是恢复不了的异常,感觉这种异常再用c++去抛出没什么意义了吧

没用,这种定位不了的,你用内存访问越界调试的一些工具试试 比如 编译选择里加 -g -fsanitize=address 或者用调试工具valgrind 说不定能检测出来