#define MAY_BE_NULL(ptr) (puts("possible NULL dereference"), (ptr))Of course we had better either turn off buffering on STDOUT or else put an fflush(STDOUT) between the puts() and the deref!
Actually, even so, the compiler can move the deref ahead of the system call. Given the sloppy nature of undefined behavior in C, there's no general solution that I'm aware of.
http://blog.regehr.org/archives/232 John