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 to implement C++14 VLA semantics


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


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