Are you sure?
Posted Jun 30, 2011 6:19 UTC (Thu) by cpeterso
In reply to: Are you sure?
Parent article: Zeuthen: Writing a C library, part 1
> Your approach (the second one) would have worked, if I could have revamped the entire source base to use it. But it is rare that one gets the opportunity to do that, and malloc() tests at least don't look strange.
If you're brave, there's always the C preprocessor:
#define malloc(size) my_xmalloc_with_msg(size, __FILE__, __LINE__, __FUNCTION__)
This approach could still be useful if your macro was only #included by a subset of .c files, leaving some object code still calling libc's
to post comments)