C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Named Return Value Optimisation [[nrvo]]

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 08 Feb 2026 19:53:47 -0800
On Saturday, 7 February 2026 16:55:58 Pacific Standard Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> mutex Func(void)
> {
> mutex m;
> m.lock();
> return m;
> }

Once again, please stop using mutexes as example. Mutexes are identity objects
and their addresses is important. Therefore, I wouldn't want to know what the
impact of returning one would be, even if mandatory NVRO were possible.

We have locks for a reason.

Find another example. You must have at least three distinct ones for the
feature to be considered.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-02-09 03:53:57