bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnulib] Re: null vs. `NUL byte'


From: Jim Meyering
Subject: [bug-gnulib] Re: null vs. `NUL byte'
Date: Sat, 26 Mar 2005 21:30:41 +0100

Paul Eggert <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>> 2005-03-26  Jim Meyering  <address@hidden>
>>
>>      * intprops.h: Say `terminating NUL byte' rather than `terminating null'.
>>      * quotearg.c: Likewise.
>>      * filemode.c: Likewise.
>
> Well, as long as we're being picky (:-), NUL is actually a character
> and is not a byte.  So, for example, Unicode UTF-16 uses a 16-bit NUL.

But isn't `NUL byte' unambiguous?
I wasn't trying to be picky.  Just wanted to avoid confusion.  I don't
think anyone will misinterpret any of the 50+ existing uses of NUL to
mean a 16-bit quantity.  Here are the three uses of `terminating null':

  $ grep ting.null *.c
  filemode.c:   10 characters are stored in STR; no terminating null is added.
  quotearg.c:   size of the output, not counting the terminating null.
  quotearg.c:   size of the output, not counting the terminating null.

Add to that the few uses of null.terminate:
(the first of which should be `NULL-terminated')

  $ grep null.termi *.c
  argmatch.c:   null-terminated array ARGLIST, return the index in ARGLIST
  argp-help.c:      *so = '\0';         /* null terminated so we can find the 
length */
  bcopy.c:   Copy LENGTH bytes from SOURCE to DEST.  Does not null-terminate.
  linebuffer.c:   that ends in a non-newline character.  Do not null terminate.
  memmove.c:   Copy LENGTH bytes from SOURCE to DEST.  Does not null-terminate.
  quotearg.c:   null-terminated string.

> POSIX uses the phrase "null byte" when it's talking about an 8-bit
> '\0' that terminates a string, regardless of whether the string is a
> properly encoded sequence of multibyte characters.  How about if we
> use that phrase uniformly, when we're talking about that notion?  We
> should use the phrase "null character" or the abbrevation NUL only
> when we're talking about characters, not bytes.

But then, what about uses of NUL-terminate?

> I suspect the existing comments sometimes say "null character" when
> they should say "null byte".

Or maybe just "'\0'"?
or `zero byte'.

I confess that I'm no longer inclined to make such changes
right now, but would welcome improvements along those lines.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]