This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to implement C++14 VLA semantics
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 13 May 2013 08:06:19 -0500
- Subject: Re: PATCH to implement C++14 VLA semantics
- References: <518BD19E dot 7080500 at redhat dot com> <5190DBBD dot 10000 at redhat dot com>
On Mon, May 13, 2013 at 7:25 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 05/09/2013 06:41 PM, Jason Merrill wrote:
>>
>> At the last C++ standards meeting, we agreed to add VLAs to the
>> language. But they're significantly different from GNU/C99 VLAs: you
>> can't form a pointer to a VLA, or take its sizeof, or really anything
>> other than directly use it. We also need to throw an exception if we
>> try to create one with a negative or too large bound.
>
>
> I'm not sure if we should throw the exception in case of large size_t
> values. Even with the checks in place, there is still a wide gap where the
> definition triggers undefined behavior due to stack overflow.
>
> This whole feature seems rather poorly designed to me. The code size
> increase due to official VLA support in C++11y might come a bit as a
> surprise. But rereading N3639, there's no way around it, at least for
> expressions of signed types.
I think there is a general mood of unsympathetic views towards liberal
"undefined behavior." Of course, implementations are always free to
offer switches to programmers who don't want checks.
-- Gaby