C++ Logo


Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 12 Aug 2020 22:41:43 +0300
On Wed, 12 Aug 2020 at 22:37, Jens Gustedt via Liaison
<liaison_at_[hidden]> wrote:
> IIRC, in C, initializer expressions within the same initializer are
> unsequenced. So the above code would not have defined behavior in C.
> Hm, that looks as if WG21 implemented a completely different feature
> than WG14 :(

We have non-trivial types. WG14 doesn't. All of your types are
trivial. Ours can be initialized
to have complex dependencies that require a particular order.

> Since it seems that designated initializers are new in C++20, had that
> particular property much been used before?

In initializer_lists, yes, since C++11. How much, I don't know, but to
some extent, certainly.

Received on 2020-08-12 14:45:19