🏳🏳🏳



Sent from my Galaxy


-------- Original message --------
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: 2/27/22 2:02 AM (GMT+04:00)
To: sotrdg sotrdg via Std-Proposals <std-proposals@lists.isocpp.org>
Cc: organicoman <organicoman@yahoo.fr>
Subject: Re: [std-proposals] Relax condition for potentially invoked destructor in constructor

On Sat, 26 Feb 2022 at 23:40, organicoman via Std-Proposals
<std-proposals@lists.isocpp.org> wrote:
> I want to be free to initialize my members in any order i wish without triggering UB.

By all means, go ahead. Wrap your members in std::optional, and then
emplace into them in any order you like,
in your constructor body.

> Constructors are about user code.
> Destructors are about object layout.
> These are two orthogonal things.

That seems like a novel reinvention of C++, as by the original design,
they are not orthogonal, as the latter
undoes what the former does. An operation that mirrors another is not
orthogonal.

> Conclusion:
>    With this approach,  we can make C++ more intuitive and secure.

I daresay such extraordinary claims require extraordinary evidence.

>     Not caring about members initialization order, frees the user from compiling his code mentaly before its compiler.
>     We can enhance C++, without changing the current standard.

Well, if you wish to suggest a class-level annotation that specifies
that the members of a class so annotated can be initialized
in any order, that could be entertained, given a good enough
rationale. That could be such an enhancement. I doubt such an
enhancement
should be entertained without an explicit opt-in, considering that
there's likely fair amounts of code that relies on the
initialization/destruction
order guarantees that we have today.