C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::elide

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sat, 18 May 2024 20:04:16 +0100
On Saturday, May 18, 2024, Lénárd Szolnoki wrote:

>
> This is "possible" in the sense that it's UB, and the UB manifests
> (possibly) in a function that returns a locked mutex.
>
> I know what you are getting at, but it's currently inexpressible in
> portable standard C++.
>


If I get up this coming Monday morning and open up Outlook to check my work
email, and see that my boss has emailed me saying "We need to add a new
function to the SDK that returns a locked mutex by value", I know I'll be
able to provide what he wants, and I know I'll be able to provide it for
any platform (MS-Windows, Linux, Arduino, Texas Instruments).

If I'm ever paranoid about the Standard's threat of undefined behaviour, I
can always look at the disassembled machine code to make sure it does what
I want, and if I'm lazy or in a rush or unfamiliar with the instruction
set, then I can ask ChatGPT to explain it to me line by line.

Just making the point here that the word 'possible' exists on a spectrum.
If your company has a $13m contract to write an SDK that returns a modified
object by value, and you need to provide the solution otherwise your
company will go bankrupt and you won't be able to afford your child's
insulin, then you *can* do it and it *will* work.

Received on 2024-05-18 19:04:19