Handling error checking with assert
问题 I've looked all over and it seems that there are a lot of mixed views on assert. For example, if I'm malloc'ing a pointer and want to make sure it's been allocated correctly I'd write: p = malloc(sizeof(int)); assert(p) instead of: p = malloc(sizeof(int)); if (p == NULL) { ... send error message } I know that with assert it will end the program, but for testing purposes — what I want to know is what the absolute safest way of: testing for things like a malloc being done correctly. dealing