GNU bug report logs - #77301
Is this a bug?

Previous Next

Package: grep;

Reported by: George R Goffe <grgoffe <at> yahoo.com>

Date: Thu, 27 Mar 2025 06:33:05 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "David G. Pickett" <dgpickett <at> aol.com>
To: "arnold <at> skeeve.com" <arnold <at> skeeve.com>,  "Dale R. Worley" <dale.worley <at> comcast.net>
Cc: "grgoffe <at> yahoo.com" <grgoffe <at> yahoo.com>, "77301 <at> debbugs.gnu.org" <77301 <at> debbugs.gnu.org>
Subject: bug#77301: Is this a bug?
Date: Fri, 28 Mar 2025 17:14:29 +0000 (UTC)
[Message part 1 (text/plain, inline)]
 You can always init the char one at a time.  :D
    On Friday, March 28, 2025 at 12:25:34 PM EDT, Dale R. Worley" via Bug reports for GNU grep <bug-grep <at> gnu.org> wrote:   

 arnold <at> skeeve.com writes:
> "Dale R. Worley" via Bug reports for GNU grep <bug-grep <at> gnu.org> 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



  
[Message part 2 (text/html, inline)]

This bug report was last modified 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.