Deutsch English Français Italiano |
<86cyk3xoqw.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c Subject: Re: c initialization algorithm Date: Sun, 13 Oct 2024 22:00:39 -0700 Organization: A noiseless patient Spider Lines: 26 Message-ID: <86cyk3xoqw.fsf@linuxsc.com> References: <vehee7$r8ri$1@dont-email.me> <20241013163050.897@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Mon, 14 Oct 2024 07:00:40 +0200 (CEST) Injection-Info: dont-email.me; posting-host="e06779884ea3dbf67bd7b93727715ea0"; logging-data="1096577"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tDDE30nwzm6/YpbAx355/2ItThoFiZao=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:ApnJu6G8zvLxwDY9dUPPVRInc+0= sha1:VrnnKzO/hmBUd6YMtqyY02oIHEE= Bytes: 1684 Kaz Kylheku <643-408-1753@kylheku.com> writes: > 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. Have you checked to C standard to see what it says about that?