[EMAIL PROTECTED] wrote:

It really depends on the context. In some cases -- if the pointer is
dereferenced -- NULL will create an obvious failure, while some random
uninitialized pointer might be harder to track down.

In other cases -- if it's used as argument to realloc(), free() etc.; or
if it's tested as a result from some other operation (getenv() in this
case) -- NULL will be treated as perfectly valid, and not give any
indication of failure at all!

Thus I don't think it's good practice in general to initialize all
pointers to NULL...
My first C language teacher told me to initialize all local variables, especially the pointers,
I follow the rule, and sometimes it does give me some help:-)
+      if (__asprintf (&name, "SOCK_SERV_%d", domain) < 0)
+    __libc_fatal ("hurd: Can't get the socket server path\n");

What happened to indentation here?!
Again it's the problem of my mail client. My mail client always replace a tab with 4 spaces.
I guess it's better for me to send the patch in the attachment.

Zheng Da



Reply via email to