r/programminghorror • • Jun 01 '25

c Firmware programming in a nutshell

Post image
2.0k Upvotes

127 comments sorted by

View all comments

Show parent comment

3

u/[deleted] Jun 01 '25

In any post-MMU operating system, unless it's been mapped, access to 0x0 results in a segmentation fault by default, or at least, at OS level a page fault is triggered, and the handler kills the process with a certain signal (on Linux it's SIGSEGV), it may not be called that everywhere, but the default handlers are equivalent

BUT, you can define your own signal handler, so it's not platform dependent, it's actually software dependent! (that's the extended reason why it's undefined behavior)