Taylor R Campbell <campbell+netbsd-source-changes-d%mumble.net@localhost> writes: >> Date: Sat, 26 Mar 2022 16:53:19 +0100 >> From: Roland Illig <roland.illig%gmx.de@localhost> >> >> 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). For background I'm a native en_US speaker whose second computer language was K&R C from the pre-ANSI edition. There are three separate concepts. NULL Refers to a pointer, never to a character NUL ASCII codepoint, 7 zero bits, and 8 zero bits when stored in an 8-bit byte. NUL is never properly written nul; the ASCII codepoints are upper case in formal usage. null An English word that can mean various things, including null pointer => NULL null character => NUL in ASCII null character => 0 in something else, theoretically maybe, but C just cannot deal with a character set that uses 0 to represent something that gets used in strings. So one can talk about a "null-terminated string" implying "null character" which means NUL, and one could also write "NUL-terminated string". I find the from NUL-terminated to be artificial. I perceive "nul-terminated" as an error due to the lower case nul.
Attachment:
signature.asc
Description: PGP signature