[Bug c/13896] Initializer string warning not printed if implied NULL-terminator out of bounds

rhajdaj at yahoo dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 28 16:52:00 GMT 2004


------- Additional Comments From rhajdaj at yahoo dot com  2004-01-28 16:51 -------
I suppose it's blasphemy to disagree with that requirement, but since '\0' is 
indeed an element of any array containing it (implicitly or otherwise), it's my 
opinion that the requirement (though it might satisfy the letter of some law), 
disagrees with descriptions of string literals like (K & R p. 38):

"The internal representation of a string has a null character '\0' at the end, 
so the physical storage required is one more than the number of characters 
written between the quotes."

So a[0][] (using the a[][3] = {{"Hel"}, {"Hi"}} example) must take up 4 bytes.  
Given the requirement, you're right.  I got nothin.  But the requirement seems 
bogus to me.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13896



More information about the Gcc-bugs mailing list