Bus error vs Segmentation fault

前端 未结 7 769
梦毁少年i
梦毁少年i 2020-12-24 01:19

Difference between a bus error and a segmentation fault? Can it happen that a program gives a seg fault and stops for the first time and for the second time it may give a bu

相关标签:
7条回答
  • 2020-12-24 02:17

    I assume you're talking about the SIGSEGV and SIGBUS signals defined by Posix.

    SIGSEGV occurs when the program references an invalid address. SIGBUS is an implementation-defined hardware fault. The default action for these two signals is to terminate the program.

    The program can catch these signals, and even ignore them.

    0 讨论(0)
提交回复
热议问题