C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Return Value Optimisation whenever you need it (guaranteed elision)

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sat, 12 Aug 2023 08:33:27 -0700
On Saturday, 12 August 2023 03:58:26 PDT Frederick Virchanza Gotham via Std-
Proposals wrote:
> I bet ChatGPT can figure this one out. Here's what I typed in:

It gave you ten options, most of which are clear no-gos. Which one do you
propose to continue with? Just throwing those options back at us doesn't help.

So I'll help. Of what it provided, this is the only one that is a currently
accepted and acceptable syntax:

int nrvo monkey;

With nrvo being a new keyword, possibly context-sensitive like final and
override.

Of the other options that don't violate existing syntax, the following could
be considered:
int monkey %nrvo;
int monkey %nrvo%;
~nrvo~ int monkey;

But if you go via this route, then it's a completely new syntax and parser
adjustments for adding syntax-changing attributes. That probably deserves a
paper on its own.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-08-12 15:33:30