C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::elide

From: Maciej Cencora <m.cencora_at_[hidden]>
Date: Thu, 23 May 2024 18:18:33 +0200
The problem is: without guaranteed NRVO you cannot create and return by
value a big array or struct containing arrays without blowing up the stack.
I don't know why everyone suddenly jumped on the 'don't use C-style arrays'
bandwagon, when I stated in the original e-mail that is not the core
problem, and std::array have the same issue.

Yeah, the sample provided by Arthur will work most of the time, but it is
not guaranteed, and it is a guarantee that is required in embedded/safety
critical systems.

czw., 23 maj 2024 o 16:59 Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> napisaƂ(a):

> On Thu, May 23, 2024 at 10:28 AM Maciej Cencora via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > What kind of semantic ambiguities are you talking about?
> > I've provided you with a specific example where without NRVO you cannot
> construct and return big arrays or structs thereof with a guarantee that it
> won't blow up the stack.
> > Using std::array doesn't solve the issue (just gets rid of one out of
> three problems there).
>
> If the problem is "I can't return arrays", maybe fix *that* instead of
> this hackery. There are plenty of places where someone wants to return
> an array where RVO isn't really the solution.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-05-23 16:18:58