C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] Designated initializers in C++ and C

From: Jens Gustedt <jens.gustedt_at_[hidden]>
Date: Wed, 12 Aug 2020 20:26:35 +0200
on Wed, 12 Aug 2020 20:49:27 +0300 you (Ville Voutilainen via Liaison
<liaison_at_[hidden]>) wrote:

> On Wed, 12 Aug 2020 at 20:24, Florian Weimer <fw_at_[hidden]> wrote:

> > > Oh, would it be possible to lift the ordering requirement? Maybe.
> > > My guesstimate is that that's an uphill battle.
> > The goal was to increase C compatibility, but according to my
> > (admittedly limited) results, this was not really achieved.
>
> Well, it was a conscious decision to increase compatibility in a
> limited fashion,
> rather than make the languages completely compatible.

That's really a pitty for that particular construct. The main reason I
personally use designated initializers is exactly that I do not have to
know the ordering of the members. It makes code much more robust against
member reordering or insertion, and avoids spurious errors when
reordering occurs and initializers are still valid but all of a sudden
have different meaning.

In most cases where I have to know the ordering, I could as well use
positional initializers.

Probably this list here didn't exist yet when this was voted, so it is
very good that Florian brought this up, now.

Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Received on 2020-08-12 13:30:07