Deutsch   English   Français   Italiano  
<20241127112746.171@kylheku.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: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: 80386 C compiler
Date: Wed, 27 Nov 2024 19:42:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <20241127112746.171@kylheku.com>
References: <vhvbhf$28opb$1@dont-email.me> <vhvsm9$2bmq9$1@dont-email.me>
 <vi0dt1$2el7m$1@dont-email.me> <20241125101701.894@kylheku.com>
 <qrp9kjd09n2v3srmabqccmnsbr1r6nkm2m@4ax.com>
 <20241125132021.212@kylheku.com> <vi6qka$3umr4$1@dont-email.me>
Injection-Date: Wed, 27 Nov 2024 20:42:50 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5c9213a27d648f761eca1543b3a5f62f";
	logging-data="162456"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+MBeX3iRIM54p4vNnBUNniR0ttY0PdGo4="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:eQjoogF3qFtO3gVtH/yiHv4W4dY=
Bytes: 2461

On 2024-11-27, David Brown <david.brown@hesbynett.no> wrote:
> On 26/11/2024 18:59, Kaz Kylheku wrote:
>> On 2024-11-25, Rosario19 <Ros@invalid.invalid> wrote:
>>> On Mon, 25 Nov 2024 18:23:58 -0000 (UTC), Kaz Kylheku  wrote:
>>>
>>>> void fn(int a)
>>>> {
>>>>    int x[3] = { foo(), bar(), a }; /* not in C90 */
>>>
>>> is in the above foo() called before bar()?
>> 
>> No, you cannot rely on that. Maybe it's fixed in a more recent standard,
>
> The implication of the word "fixed" is that you think the current 
> standards as somehow "broken" in this respect.  Do you think that is the 
> case?

The specification has an inconsistency, because it gives the order
in which initializations occur, yet not the order of evaluation of
the expressions that produce their values.

Above we know that x[0] is initialized first before x[1].

That doesn't even matter unless initializations are being observed,
which they can be if there is self-reference going on, like:

  int x[3] = { foo(), x[0] + bar(), x[0] + x[1] }

I'm assuming this sort of thing must to be the purpose for specifying
the order of initialization.

It looks inconsistent to me that the effects of the subobjects receiving
their inital values are ordered, but all other effects are not.

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