Hi, On Sun, Aug 17, 2008 at 01:57:18PM +0200, zhengda wrote: > [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:-) Interesting... Anyways, check how other parts of glibc handle this, and try to be consistent :-) -antrik-