cvs commit: src/lib/libc/rpc clnt_simple.c
M. Warner Losh
imp at bsdimp.com
Wed Oct 29 21:32:45 PST 2003
In message: <20031029101805.GA24695 at falcon.midgard.homeip.net>
Erik Trulsson <ertr1013 at student.uu.se> writes:
: On Wed, Oct 29, 2003 at 10:57:00AM +0100, Pawel Jakub Dawidek wrote:
: > On Wed, Oct 29, 2003 at 01:18:44AM -0800, Martin Blapp wrote:
: > +> Commiter: Martin Blapp <mbr at FreeBSD.org>
: >
: > Hi Martin!:)
: >
: > +> Log:
: > +> Don't use NULL to compare against a character.
: > [...]
: > +> - if ((nettype == NULL) || (nettype[0] == NULL))
: > +> + if ((nettype == NULL) || (nettype[0] == 0))
: >
: > More correct is to use '\0' for characters comparsion.
:
: No, not *more* correct. '\0' and 0 are both constants with type "int"
: and value zero, so they can be used interchangeably.
: For stylistic reasons one might wish to use '\0' instead of 0 for
: character comparisons, but the the C language does not make a
: difference.
Yes. More correct. For the same reason that
while (foo) {
...
}
is more correct than:
top:
if (foo) goto out;
...
goto top;
out:
In that it is the more appropriate construct to use in the context.
Even though they are both guaranteed to be the same, one is more
correct than the other.
Warner
More information about the cvs-src
mailing list