This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: funny problem with g++
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Tommy Vercetti <vercetti at zlew dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 7 Dec 2005 16:26:55 +0100
- Subject: Re: funny problem with g++
- References: <A3743F9D-3B07-4BA9-97CE-7E1853C5B272@zlew.org>
On 12/7/05, Tommy Vercetti <vercetti@zlew.org> wrote:
> Hi there
>
> We had funny issue here lately. Someone wanted to create table that
> had 0 elements in C++, for instance this code:
This is a gcc extension. Try g++ -pedantic
Richard.
> int main()
> {
> char a[0];
> char b[0];
>
> a[0] = 1;
> b[0] = 2;
>
> return a[0] + b[0];
> }
>
> is perfectly ok for g++, it isn't for other compilers.
> I would say this should cause fatal error. Even without any -W flags on.
> -pedantic works fine, but this should be an error always, not just
> when -pedantic is used.
>
>
> Thanks.
>
> --
> TV
>
> "If we knew what we were doing, it wouldn't be called Research, would
> it?" - AE
>
>
>
>
>