This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] Add C++14's dynarray container (23.3.4, n3662).
- From: Rüdiger Sonderfeld <ruediger at c-plusplus dot de>
- To: Joe Buck <Joe dot Buck at synopsys dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 26 Sep 2013 03:29:18 +0200
- Subject: Re: [RFC] Add C++14's dynarray container (23.3.4, n3662).
- Authentication-results: sourceware.org; auth=none
- References: <1432997 dot xnirGqHOQ2 at descartes> <20130926005728 dot GA10930 at synopsys dot com>
On Wednesday 25 September 2013 17:57:28 Joe Buck wrote:
> As you say, dynarray should be the C++ equivalent of VLAs, so ideally the
> compiler could use the same code as is used for VLAs, perhaps by creating
> new builtin functions if there isn't something that can already be used.
> It might not be possible to produce a quality library-only implementation,
> compiler support might be needed.
I don't think it can be done without compiler support. There would have to be
a builtin function to allocate stack memory in the calling function to make it
work. (Calling alloca inside a dynarray library function of course won't do
it. Don't know why I tried it initially.)
Regards,
RÃdiger