Re: c initialization algorithm

Liste des GroupesRevenir à cl c  
Sujet : Re: c initialization algorithm
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.c
Date : 14. Oct 2024, 00:33:04
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20241013163050.897@kylheku.com>
References : 1
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-10-13, Thiago Adams <thiago.adams@gmail.com> wrote:
The algorithm for C initialization as described in the standard and
implemented in gcc allow this.
>
struct X{
     int a,b,c;
};
>
int main()
{
     struct X x = {.a=1,2,3,.a=1, 2, 3};
}
>
https://godbolt.org/z/7naedbEM6
>
Basically, when a designed initializer is found the "cursor" goes to
that member and the following members are initialized in order.
 
 I do not suspect that therw is an observable order. I.e. as
 in a required order considered observable behavior.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
13 Oct 24 * c initialization algorithm7Thiago Adams
14 Oct 24 `* Re: c initialization algorithm6Kaz Kylheku
14 Oct 24  `* Re: c initialization algorithm5Tim Rentsch
14 Oct 24   `* Re: c initialization algorithm4Thiago Adams
15 Oct 24    `* Re: c initialization algorithm3Thiago Adams
15 Oct 24     `* Re: c initialization algorithm2Thiago Adams
15 Oct 24      `- Re: c initialization algorithm1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal