3 ms·
Hiding the error does not mean that the error did not occur or that it is not a problem.. It was about to occur and there is still a fundamental problem in you
by jetsnoc 17y ago
Hiding the error does not mean that the error did not occur or that it is not a problem.. It was about to occur and there is still a fundamental problem in your logic leading up to the would-have-been segfault that was swept under the rug.
I would much rather know where my code tried to access a null memory space and what/why/how a null pointer was passed than to have it "fake" that it didn't ever happen! A signal handler for a SIGSEGV/SIGBUS is a great place to add a syslog() so you can find the error in your logic and correct it.
- sophacles 17y agoUnless of course you are explicitly trying to get around silly things like SIGSEGV because the 0x0 is where the OS keeps interesting things, like say interrupt jump tables...
- senko 17y ago> Hiding the error does not mean that the error did not occur or that it is not a problem.. It was about to occur and there is still a fundamental problem in your logic leading up to the would-have-been segfault that was swept under the rug. It's an error only if you didn't want to dereference address 0. If you know it's safe and useful to do so on the system for which you're developing, why shouldn't you be able to do it? As the KSplice article shows, on Linux (under specific setup which is not the default), you can actually have something mapped there. I'd be hard pressed to invent a convincable scenario in which you would want to do it, but that doesn't mean there is none.