This is the mail archive of the gcc-patches@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]

Re: PATCH RFA: -Wc++-compat warning about array initialized with string


On Tue, 16 Jun 2009, Ian Lance Taylor wrote:

> Using a string constant to initialize an array whose size is the length
> of the string is permitted in C, but not in C++.  E.g.,
>   char a[1] = "a";
> is OK in C but not C++.  C++ requires that the array have space for the
> zero byte.
> 
> This patch adds this warning to -Wc++-compat.  It also fixes the single
> case found by a gcc bootstrap where the gcc code has this problem.  This
> patch requires approval by a C frontend maintainer.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for mainline?

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com


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