Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 2018 12:09:33 -0800
From:      Conrad Meyer <cem@freebsd.org>
To:        Eric van Gyzen <eric@vangyzen.net>
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:  <CAG6CVpWW32LQmYgn438O5eFWirVvLdy7d1E0ms74pZiwic-wuw@mail.gmail.com>
In-Reply-To: <1b3a489d-d62c-6f88-a269-a35ad9bf5ef5@vangyzen.net>
References:  <201802131917.w1DJHmso047463@repo.freebsd.org> <1518549829.85310.39.camel@freebsd.org> <CAPyFy2Cckiz8iBzy664-%2BpVCPJhmxdD_JmzmEpSo5WFV-b8DEA@mail.gmail.com> <1b3a489d-d62c-6f88-a269-a35ad9bf5ef5@vangyzen.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 13, 2018 at 11:52 AM, Eric van Gyzen <eric@vangyzen.net> wrote:
> On 02/13/2018 13:43, Ed Maste wrote:
>> On 13 February 2018 at 14:23, Ian Lepore <ian@freebsd.org> wrote:
>>> 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,
>> ...
>
> I prefer '\0' here because it tells the reader that it's a NUL
> character, as opposed to a NULL pointer or a zero integer.  Yes, the
> reader should already know that, but the author can /help/ the reader by
> communicating more clearly and completely.

And I prefer 0, because it's easier to type and conveys exactly the
same meaning.  A character NUL is simply a zero integer of char type.

These are standard library string manipulation routines with char
pointer types.  It is already extremely clear to the reader that the
zeros involved are end-of-string sentinels.

Best,
Conrad



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