Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #389115

Re: 80386 C compiler

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: 80386 C compiler
Date 2024-11-26 13:05 -0800
Organization None to speak of
Message-ID <875xo9ln93.fsf@nosuchdomain.example.com> (permalink)
References (1 earlier) <vhvsm9$2bmq9$1@dont-email.me> <vi0dt1$2el7m$1@dont-email.me> <20241125101701.894@kylheku.com> <qrp9kjd09n2v3srmabqccmnsbr1r6nkm2m@4ax.com> <20241125132021.212@kylheku.com>

Show all headers | View raw


Kaz Kylheku <643-408-1753@kylheku.com> writes:
> 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,
> but C99 (which I happen to have open in a PDF reader tab) stated that 
> "The order in which any side effects occur among the initialization list
> expressions is unspecified.".  This implies that there is no sequence
> point between any two initializing expressions, which means we don't
> know whose expression's function call takes place first.

N3096 (C23 draft) has :
"""
The evaluations of the initialization list expressions are
indeterminately sequenced with respect to one another and thus the order
in which any side effects occur is unspecified.
"""

C23 is more explicit (redundant?) than C99, which doesn't mention the
lack of a sequence point.  (C11 dropped sequence points, replacing them
with "sequenced before", "sequenced after", and "unsequenced", basically
a new way of describing the same semantics.)

Given:

    int n = 42;
    int a[] = { n++, n++ };

C99 could imply that the value of a is merely unspecified, either {
42, 43 } or { 43, 42 }.  Though it can almost certainly be inferred
from other parts of the C99 standard that there is no sequence
point between the two evaluations of n++ (I haven't taken the time
to check).

> In any case, a C90 compiler with the above support as an extension to
> C90 can specify rigid sequencing behavior.

True, but I don't know of anyone who's interested in a C 90 compiler
with this kind of extension.  Paul Edwards has made it clear he's only
interested in unextended C90, and anyone else can just use a more modern
compiler.

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

80386 C compiler "Paul Edwards" <mutazilah@gmail.com> - 2024-11-24 22:00 +0800
  Re: 80386 C compiler fir <profesor.fir@gmail.com> - 2024-11-24 18:51 +0100
    Re: 80386 C compiler fir <profesor.fir@gmail.com> - 2024-11-24 18:58 +0100
      Re: 80386 C compiler "Paul Edwards" <mutazilah@gmail.com> - 2024-11-25 08:00 +0800
    Re: 80386 C compiler Bart <bc@freeuk.com> - 2024-11-24 18:00 +0000
      Re: 80386 C compiler BGB <cr88192@gmail.com> - 2024-11-24 17:46 -0600
        Re: 80386 C compiler "Paul Edwards" <mutazilah@gmail.com> - 2024-11-25 08:15 +0800
  Re: 80386 C compiler Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-11-24 19:52 +0100
    Re: 80386 C compiler "Paul Edwards" <mutazilah@gmail.com> - 2024-11-25 07:46 +0800
      Re: 80386 C compiler Kaz Kylheku <643-408-1753@kylheku.com> - 2024-11-25 18:23 +0000
        Re: 80386 C compiler Rosario19 <Ros@invalid.invalid> - 2024-11-25 22:14 +0100
          Re: 80386 C compiler Kaz Kylheku <643-408-1753@kylheku.com> - 2024-11-26 17:59 +0000
            Re: 80386 C compiler Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-11-26 13:05 -0800
              Re: 80386 C compiler "Paul Edwards" <mutazilah@gmail.com> - 2024-11-27 05:30 +0800
                Re: 80386 C compiler Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-11-26 14:27 -0800
                Re: 80386 C compiler "Paul Edwards" <mutazilah@gmail.com> - 2024-11-27 13:23 +0800
                Re: 80386 C compiler Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-11-26 21:59 -0800
                Re: 80386 C compiler "Paul Edwards" <mutazilah@gmail.com> - 2024-11-27 21:50 +0800
              Re: 80386 C compiler Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-11-27 16:45 -0800
            Re: 80386 C compiler David Brown <david.brown@hesbynett.no> - 2024-11-27 11:00 +0100
              Re: 80386 C compiler Kaz Kylheku <643-408-1753@kylheku.com> - 2024-11-27 19:42 +0000
                Re: 80386 C compiler James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-11-27 14:59 -0500
                Re: 80386 C compiler Kaz Kylheku <643-408-1753@kylheku.com> - 2024-11-27 21:52 +0000
                Re: 80386 C compiler James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-11-27 18:07 -0500
                Re: 80386 C compiler Kaz Kylheku <643-408-1753@kylheku.com> - 2024-11-30 01:30 +0000
                Re: 80386 C compiler Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-11-29 21:00 -0800
                Re: 80386 C compiler James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-11-30 09:00 -0500
                Re: 80386 C compiler David Brown <david.brown@hesbynett.no> - 2024-11-28 09:12 +0100
            Re: 80386 C compiler Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-11-27 19:26 -0800
            Re: 80386 C compiler Rosario19 <Ros@invalid.invalid> - 2024-11-30 16:41 +0100
        Re: 80386 C compiler "Paul Edwards" <mutazilah@gmail.com> - 2024-11-26 10:48 +0800
  Re: 80386 C compiler Lynn McGuire <lynnmcguire5@gmail.com> - 2024-11-25 15:55 -0600
    Re: 80386 C compiler Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-11-25 14:10 -0800
      Re: 80386 C compiler Lynn McGuire <lynnmcguire5@gmail.com> - 2024-11-25 18:32 -0600
        Re: 80386 C compiler Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-11-25 16:49 -0800
          Re: 80386 C compiler BGB <cr88192@gmail.com> - 2024-11-26 13:22 -0600

csiph-web