2 ms·
I also have the heretical belief that for the vast majority of applications, the best way to handle malloc() returning NULL is to abort the process. The main r
by dbmem 7y ago
I also have the heretical belief that for the vast majority of applications, the best way to handle malloc() returning NULL is to abort the process.
The main reason is that the error handling code has a high probability of being buggy because allocating memory is pervasive in most code and it's unlikely that you're going to have tests that provide adequate coverage of all the interesting code paths. The consequences of incorrect behaviour are often worse than the consequences of a process crash.