On Sat, Mar 26, 2022 at 9:53 AM Roland Illig <roland.il...@gmx.de> wrote:

> Am 24.03.2022 um 02:55 schrieb David H. Gutteridge:
> > Module Name:  src
> > Committed By: gutteridge
> > Date:         Thu Mar 24 01:55:15 UTC 2022
> >
> > Modified Files:
> >       src/lib/libc/gen: popen.3
> >
> > Log Message:
> > popen.3: minor spelling, grammar, style, and xref tweaks
> >
> >
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/popen.3
>
> The term "null-terminated string" is quite common when talking about C.
>   In contrast, the word "nul" in "nul-terminated" always reminds me of
> the character abbreviation in ASCII, which has a narrower scope than C.
>   I prefer to keep "null-terminated" here.
>

The standard uses "null-terminated" and "null character" (see Character
Sets section 5.2.1 (from the C2x draft, but this term dates back to C89):
"A byte with all bits set to 0, called the null character, shall exist in
the basic execution character set; it is used to terminate a character
string."
I couldn't find the definition for null-terminated though. This is
different than the NULL #define

Not to be confused with the all zeros ASCII charater, whose mnemonic is
NUL, which is where some pressure to use NUL terminated comes from. I agree
that it's usage is narrower and really only relevant for certain ASCII and
ASCII-derived character sets, which is why the standard chose the spelling
it did.

Since all the 'C' standards[*] use "null-terminated" and "null character",
it's likely best to use that terminology because there is a source of truth
for its definition in case of ambiguity or doubt.

Warner

[*] I've not gone the extra mile and checked to see if K&R used this
phrase, to be honest.

Reply via email to