[ntp:questions] Unresolved Symbol

Maarten Wiltink maarten at kittensandcats.net
Tue Aug 21 08:01:42 UTC 2007


"Aggie" <c.kevin.lam at gmail.com> wrote in message
news:1187653764.667735.309710 at m37g2000prh.googlegroups.com...
[...]
> Yes, I think you are right on the dereferncing a NULL part. Is there a
> NUL?? is it the same as NULL??
> Here's the line that gave me error:
>     if ((pOpts->pzCurOpt != NULL) && (*pOpts->pzCurOpt != NUL))

There is, and it itsn't. NULL is a pointer that doesn't point anywhere;
NUL is the character at code point 0, used primarily to indicate the
end of a string.

In that line of code, the pzCurOpt member of the pOpts struct is a
pointer, apparently a pointer to char. The asterisk in the second term
dereferences this pointer (that is, the pzCurOpt, not the pOpts), and
so what the line does is first check that the pointer does in fact point
somewhere, then check that it doesn't point to the end of the character
string.

It is in all likelihood testing for an empty string, which would indicate
that there are no more parameters (option strings). Incidentally, I think
it is not the dereferencing of pzCurOpt that's failing (it checks against
that after all), but that of pOpts. pOpts might be NULL is something went
wrong during parsing and it was never successfully allocated.

Groetjes,
Maarten Wiltink





More information about the questions mailing list