From owner-cvs-src@FreeBSD.ORG Wed Oct 29 21:32:45 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4256016A4CE; Wed, 29 Oct 2003 21:32:45 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id F244A43FAF; Wed, 29 Oct 2003 21:32:43 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.9p2/8.12.9) with ESMTP id h9U5WcE7038986; Wed, 29 Oct 2003 22:32:42 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 29 Oct 2003 22:32:37 -0700 (MST) Message-Id: <20031029.223237.01027561.imp@bsdimp.com> To: ertr1013@student.uu.se From: "M. Warner Losh" In-Reply-To: <20031029101805.GA24695@falcon.midgard.homeip.net> References: <200310290918.h9T9IiwQ095857@repoman.freebsd.org> <20031029095700.GU84474@garage.freebsd.pl> <20031029101805.GA24695@falcon.midgard.homeip.net> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: mbr@FreeBSD.org cc: cvs-all@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-src@FreeBSD.org Subject: Re: cvs commit: src/lib/libc/rpc clnt_simple.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2003 05:32:45 -0000 In message: <20031029101805.GA24695@falcon.midgard.homeip.net> Erik Trulsson 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 : > : > 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