svn commit: r329237 - head/sys/libkern

Conrad Meyer cem at freebsd.org
Tue Feb 13 20:09:40 UTC 2018


On Tue, Feb 13, 2018 at 11:52 AM, Eric van Gyzen <eric at vangyzen.net> wrote:
> On 02/13/2018 13:43, Ed Maste wrote:
>> On 13 February 2018 at 14:23, Ian Lepore <ian at 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


More information about the svn-src-all mailing list