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: Sun, 16 Jul 2023 20:58:51 -0700
On Sunday, 16 July 2023 02:53:22 PDT Frederick Virchanza Gotham via Std-
Proposals wrote:
> I've made it generic, so maybe they're more interested in returning a
> decremented semaphore or a true atomic_flag?

Why would you want to do that?

Threading synchronisation objects need to be globally accessible, because
that's their purpose. Two threads can't refer to the same object if it's
returned on the stack by a function, since by definition two threads have
different stacks.

Please give a better example.

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

Received on 2023-07-17 03:58:52