> Date: Sat, 26 Mar 2022 16:53:19 +0100 > From: Roland Illig <roland.il...@gmx.de> > > 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.
I feel like I've usually seen it as NUL-terminated. I thought it was in /usr/share/misc/style but I must have been thinking of a different style guide. `NUL' is better than `null' or `NULL' here because it's not a null pointer, unlike, e.g., the execve argv terminator. Even if the string isn't US-ASCII, what character encoding calls a nonzero byte `NUL'? `NUL' is better than `zero' or `0' here because it's unambiguously the all-bits-zero byte, not the US-ASCII encoding of `0' (i.e., decimal 48 or 0x30). `C string' is ambiguous because there are also char arrays that function as strings but which are not guaranteed to be NUL-terminated, as strncpy is intended for.