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


Groups > comp.lang.c > #158576

Re: New sequencing model

Path csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: New sequencing model
Date Sat, 23 Jan 2021 08:48:30 -0800
Organization A noiseless patient Spider
Lines 49
Message-ID <86v9bnmwf5.fsf@linuxsc.com> (permalink)
References <rue4tv$f2f$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info reader02.eternal-september.org; posting-host="52b538951ae99e6f169b0f62774a9fae"; logging-data="22999"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Gxp1ahMwtwjBNEueYLZdQG3Vd+HrXUno="
User-Agent Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock sha1:TU/wGUyzQewo0XwyVRhM7gxyi3g= sha1:VzsXJ5gZ9QifhTP/vNOFUFwAs0I=
Xref csiph.com comp.lang.c:158576

Show key headers only | View raw


Andrey Tarasevich <andreytarasevich@hotmail.com> writes:

> Hello
>
> As you know, C11 (together with C++11) adopted the new sequencing
> model based in the *sequenced before* relation between
> evaluations.  One immediately noticeable property of this sequencing
> model is that it may apply separately to
>
> 1. value computations of an evaluation, and
> 2. side effects of an evaluation
>
> This means that in general case we can sequence value computations and
> side effects independently.  The C standard also retains the classic
> notion of *sequence point*, which is now derivative from the above
>
> 5.1.2.3
> 3.  [...] The presence of a sequence point between the evaluation of
> expressions A and B implies that every value computation and side
> effect associated with A is sequenced before every value computation
> and side effect associated with B.
>
> This implies that separation between 1 and 2 above in the new
> sequencing model supposedly makes it more flexible than the old model
> based on sequence points.  E.g. not every sequencing in C11 is a
> sequence point.
>
> But where is the tangible benefit of that?  Can someone come up with an
> example of where this extra flexibility makes a difference in the
> language?  [...]

A formalism for sequencing is pretty much necessary to talk about
the semantics of multiple threads.  Since C11 decided to add
threading, it basically had to put in a better sequencing model.

Leaving aside anything having to do with threads or concurrency
(that is, explicit concurrency), my understanding is that the
sequencing rules in C11 are just a more formal and precise way of
saying what had been intended for sequencing relationships in C
all along.  The C standard committee had wanted to do this for a
long time, and several attempts were made even before C99 was
finished.  But those early efforts were deemed unsatisfactory
for whatever reason (and in hindsight rightly so - the C11 model
is definitely better IMO than the earlier efforts).

All this is a rather long way of saying I think the C11 sequencing
rules should be thought of as applying to pre-C11 standards as
well, and not to spend too much time thinking about how the rules
have changed.  AFAICT the intention is that they have not.

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


Thread

New sequencing model Andrey Tarasevich <andreytarasevich@hotmail.com> - 2021-01-22 01:12 -0800
  Re: New sequencing model Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-01-23 08:48 -0800

csiph-web