When we free() memory in C, why is that memory not filled with zero? Is there a good way to ensure this happens as a matter of course when calling free()<
The original C philosophy was to have keep implicit effects to an absolute minimum. If a programmer wants a pointer zeroed after the memory pointed to is freed, that's what the programmer should write. Those of us who do often use a macro like this one:
#define FREE(P) ((void)(free((P)), (P) = NULL))
Of course if the expression passed to FREE has side effects, one has just opened a large can of worms...