This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]