IsBadReadPtr analogue on Unix

后端 未结 4 1630
执念已碎
执念已碎 2020-12-21 18:13

Is there a function analogous to IsBadReadPtr in Unix? At least some functionalities of IsBadReadPtr? I want to write a procedure which would react if something bad happens

4条回答
  •  温柔的废话
    2020-12-21 18:47

    How can you do it?

    You try to do it and then handle the error.

    To do this, first you set up a sigsetjmp and a SIGSEGV signal handler. Then attempt to use the pointer. If it was a bad pointer then the SIGSEGV handler is called and you can jump to safety and report the error to the user.

提交回复
热议问题