On Sat, Jul 03, 2021 at 03:14:21PM +0100, Jonny Grant wrote: > We'd rather have stability and logging of errors than a core dump. Especially on embedded systems that need to guarantee safety. It's easy enough to check for NULL and check the bounds of buffers etc before using. Asserts would trigger in a debug build. There *is* no generic way you can sanely and even safely handle null pointer dereferences at all. You *have to* separately write code for every place you want to do something special with null pointers (or any other special case for that matter). In case you are talking about a system with an event loop (or similar), where you can just abort the task you are doing, and get back to waiting for more work to do: you can just catch *all* fatal errors (which a null dereference normally is), log it, and go back to the main loop. But even then the null dereference could be caused by something that is not yet fixed. If you are lucky other tasks can still be done. OTOH, perhaps just as often nothing will work anymore. In any case, there is nothing the compiler can do for you here. If programming were a mechanical job, we wouldn't need all those pesky programmers :-) Segher