|
|
|
|
|
by jheriko
4519 days ago
|
|
"Check for NULL at beginning of function or blocks which are dereferencing pointers to dynamically allocated memory" I really strongly disagree with this. Better for it to crash if you expect this memory to always have been allocated. This way you can fix your bug instead of putting your app into some potentially unexpected state... if allocations fail it doesn't make sense to just 'carry on anyway' in many situations. |
|
Otherwise, you need a way for the cleanup code to dispose of the resources and leave the system in a consistent state before crashing.
Ok, its obviously good practice to develop your software in a way that a random outage doesn't leave anything in an inconsistent state, but a lot of software fails to do this. At the very least, you may end up with something like when a server crashes and cannot restart because the port is still considered in use by the OS.