This is the mail archive of the
mailing list for the GCC project.
Re: PATCH RFA: -Wc++-compat warning about array initialized with string
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 17 Jun 2009 10:20:29 +0000 (UTC)
- Subject: Re: PATCH RFA: -Wc++-compat warning about array initialized with string
- References: <email@example.com>
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 = "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?
Joseph S. Myers