2 ms·
Crash-only code sounds good. It is worth remembering that the convention in early c development was to check for null values whenever doing memory allocation.
by joe_the_user 14y ago
Crash-only code sounds good.
It is worth remembering that the convention in early c development was to check for null values whenever doing memory allocation. In most PC programs, this convention added considerable overhead more or less for nothing since once a program runs out of memory, recovery really possible (oh, and Linux doesn't even return zero even when out of memory, it just boot programs).
- fleitz 14y agoChecking for null values from malloc does not create serious overhead, it creates minor overhead for your branch predictor, unless for some reason malloc frequently returns null. A single context switch back to the kernel generates far more load than the null checks could ever hope to accomplish.
- joe_the_user 14y agoI mean all those checks create considerable mental overhead from code-bloat.