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 trav at mac dot com  2004-05-19 21:44 -------
(In reply to comment #10)
> You're right.  This compiler works in agreement with the requirement, so I 
> should stop bugging you guys.  I guess I'm just not seeing the "why" behind the 
> requirement.  When in is it a perfectly acceptable condition (ie according to -
> Wall) not to null-terminate a literal string in an array like this?  (I don't 
> understand the "if there's room" part of the requirement.)  And who do I talk 
> to to challenge requirements so I can leave you alone?
> 

Here is the rationale:

Since it is an array of characters, you should be able to use a convenient initializer to specify every 
element of the array, including the last. Thus, you are allowed to use a double-quoted string, and no 
null-character will be stored.

Not that I agree with making it so easy to create a unterminated string...


-- 


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]