Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 2018 12:54:39 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        Ed Maste <emaste@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r329237 - head/sys/libkern
Message-ID:  <1518551679.72050.4.camel@freebsd.org>
In-Reply-To: <CAPyFy2Cckiz8iBzy664-%2BpVCPJhmxdD_JmzmEpSo5WFV-b8DEA@mail.gmail.com>
References:  <201802131917.w1DJHmso047463@repo.freebsd.org> <1518549829.85310.39.camel@freebsd.org> <CAPyFy2Cckiz8iBzy664-%2BpVCPJhmxdD_JmzmEpSo5WFV-b8DEA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2018-02-13 at 14:43 -0500, Ed Maste wrote:
> On 13 February 2018 at 14:23, Ian Lepore <ian@freebsd.org> wrote:
> > 
> > On Tue, 2018-02-13 at 19:17 +0000, Ed Maste wrote:
> > > 
> > > Author: emaste
> > > Date: Tue Feb 13 19:17:48 2018
> > > New Revision: 329237
> > > URL: https://svnweb.freebsd.org/changeset/base/329237
> > > 
> > > Log:
> > >   libkern: use nul for terminating char rather than 0
> > > 
> > >   Akin to the change made in r188080 for lib/libc/string/.
> > > 
> > >   Reported by:        bde
> > >   Sponsored by:       The FreeBSD Foundation
> > There are many ways to spell 0.  Why are we using something other
> > than
> > the simplest way?  Is it a style rule thing, or is it portability-
> > correctness, or what?
> I made the change to improve consistency between lib/libc/string and
> sys/libkern, which is what Bruce commented on some time ago. I don't
> have a personal preference for 0 or '\0' but definitely believe that
> if we have multiple, similar copies of a function they ought to avoid
> gratuitous differences. (I'm happy to change both trees to 0 if
> that's
> preferred.)
> 

Oh, I agree completely about consistancy being important.  I just
wanted to know whether I should try to remember to always use \0
because it's a rule or has some benefit I didn't know about.

20+ years ago I used to slavishly ensure I always used \0 when a char
type was involved, just as a personal style thing.  Then over time I
came to the conclusion that "0 is 0 no matter how you spell it, so keep
it simple" (except for pointers... even in c++ I've always used NULL).

-- Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1518551679.72050.4.camel>