Subject: bug#77301: Is this a bug?

From: "Dale R. Worley" <[email-masked]>
Date: Fri, 28 Mar 2025 12:24:36 -0400

[email-masked] writes:
> "Dale R. Worley" via Bug reports for GNU grep <[email-masked]> wrote:
...
>> That is strange:  I can't find any statement that recent C standards
>> have removed the special case "initialize a char array that doesn't have
>> room for the final NULL from a string literal".
>
> The bug is that the constants given for the sizes are each to small by one.
> Count the characters in each string, add 1 for the final '\0', and
> you'll see.

Yes, but ... Back when I was programming in C (and when I was involved
in writing a C compiler), there was a specific clause in the C standard
for that case, saying that it was OK, the characters went into the
char[] variable, and the final NUL was to be ignored.  When I said
"special case" above, I meant it.

I expect I've thrown away the copy I have of the draft of the original
ANSI C, so I can't check that, and ANSI is uptight so there aren't
copies of the current standard on online.  But trying to search for
statements about the *idea*, I couldn't find any online reference saying
that some Cnn standard had removed that special case.

Dale