Catching “Stack Overflow” exceptions in recursive C++ functions

前端 未结 11 1215
暖寄归人
暖寄归人 2020-12-01 16:34

Is it possible to catch a stack overflow exception in a recursive C++ function? If so, how?

so what will happen in this case

void doWork         


        
11条回答
  •  隐瞒了意图╮
    2020-12-01 17:26

    In Windows you can use structured exception handling (SEH), with __try and __except keywords to install your own exception handler routine that can catch stack overflows, access violation, etc etc.

    It's pretty neat to avoid Windows' default crash dialog, and replace it with your own, if you need to.

提交回复
热议问题