From mboxrd@z Thu Jan 1 00:00:00 1970 From: "John R. Moore" To: Subject: xfree() -- set ptr to nil (fwd) Date: Mon, 12 Feb 2001 15:07:00 -0000 Message-id: X-SW-Source: 2001-02/msg00178.html Whilst fixing xfree() callsI noticed that xfree() itself has a peculiarity that needs attention: The call goes like this: if (ptr != NULL) free(ptr); Nice, but why not the following: if (ptr) { free (ptr); prt = NULL); } The latter catches any re-calls to xfree(), unless the compiler sets the ptr to nil for one (gcc doesn't appear to). Anyhow, it's a good practice to do this anyhow. Any opinions? The only reason I can think not to is to insure that gdb core dumps on succesive xfree() calls to the same pointer (and hence insure efficient code, but in that case, why bother with xfree() in the first place. John Moore