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


Groups > comp.lang.c++ > #122120

Re: Pre-main construction order in modules

From "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Pre-main construction order in modules
Date 2025-04-01 12:39 -0700
Organization A noiseless patient Spider
Message-ID <vshfcs$3smrc$1@dont-email.me> (permalink)
References (5 earlier) <vse2ep$8iai$2@dont-email.me> <vse775$er2o$1@dont-email.me> <vsf99o$1hbqv$1@dont-email.me> <vsg4fq$2hn25$1@dont-email.me> <vshbgm$362k4$2@dont-email.me>

Show all headers | View raw


On 4/1/2025 11:32 AM, James Kuyper wrote:
> On 01.04.2025 10:26, Muttley@DastardlyHQ.org wrote:
>> On Mon, 31 Mar 2025 19:42:48 -0400
>> James Kuyper <jameskuyper@alumni.caltech.edu> wibbled:
>>> On 31.03.2025 17:01, Muttley@DastardlyHQ.org wrote:
>>>> On Mon, 31 Mar 2025 15:39:53 +0300
>>>> Paavo Helde <eesnimi@osa.pri.ee> wibbled:
>>>>> On 31.03.2025 12:09, Muttley@DastardlyHQ.org wrote:
>>>>> "If [initialization] is deferred, it strongly happens before any
>>>>> non-initialization odr-use of any non-inline function or non-inline
>>>>> variable defined in the same translation unit as the variable to be
>>>>> initialized."
>>>>
>>>> Who writes this stuff? Its borderline gibberish.
>>>
>>> Keep in mind that the key thing that makes this seem like gibberish is
>>> the use of precisely defined technical jargon, which is used for the
>>> same reason that jargon is used in many other contexts: it has a more
>>> precisely specified meaning than more informal wording would have had.
>>>
>>> Key pieces of jargon: "strongly happens before", "non-initialization",
>>
>> "strongly happens before" is genuine gibberish. Either something happens before
>> or it doesn't, the adverb is entirely superfluous.
> 
> Terms are explicitly defined by the C++ standard precisely because their
> meaning cannot be inferred by using ordinary English to interpret the
> words that make them up. Both "happens before" and "strongly happens
> before" are separate pieces of C++ jargon, and the requirements for
> qualifying as "strongly happens before" are in fact stronger than those
> for "happens before".
> 
> "An evaluation A happens before an evaluation B (or, equivalently, B
> happens after A) if:
> (10.1)— A is sequenced before B, or
> (10.2)— A inter-thread happens before B.
> The implementation shall ensure that no program execution demonstrates a
> cycle in the “happens before” relation. [Note: This cycle would
> otherwise be possible only through the use of consume operations. — end
> note]" (6.9.2.1p10).
> 
> the first occurrence of "happens before" in that clause is in italics,
> an ISO convention indicating that it is a piece of specialized jargon
> whose definition is provided by the sentence in which it occurs. Note
> that "sequenced before" and "inter-thread happens before" are two other
> pieces of standard-defined jargon.
> 
> "An evaluation A strongly happens before an evaluation D if, either
> (12.1)— A is sequenced before D, or
> (12.2)— A synchronizes with D, and both A and D are sequentially
> consistent atomic operations (31.4), or
> (12.3)— there are evaluations B and C such that A is sequenced before B,
> B simply happens before C, and C is sequenced before D, or
> (12.4)— there is an evaluation B such that A strongly happens before B,
> and B strongly happens before D.
> [Note: Informally, if A strongly happens before B, then A appears to be
> evaluated before B in all contexts. Strongly happens before excludes
> consume operations. — end note]"
> 
> The first occurrence of "strongly happens before" in that clause is also
> italicized.
> 
> Note that "A is sequenced before D" would be sufficient to ensure that
> both "A happens before D" and "A strongly happens before D" are true.
> The difference between the two terms only shows up if A is not sequenced
> before D. In that case, at a minimum you must have "A inter-thread
> happens before D", but is not synchronized with D.
> 
> For instance A inter-thread happens before D if it is dependency-ordered
> before D. (6.9.2.1p9). This could happen if A performs a release
> operation on an atomic object M , and, in another thread, D performs a
> consume operation on M and reads the value written by A (6.9.2.1p8).
> 
> In that case, the requirements associated with "A happens before D" must
> be met, but those associated with "A strongly happens before D" need not be.
> 
> Do you need an explanation of the parts of the above explanation that
> use the terms "release" and "consume"? I have little experience with
> multi-threaded code - someone else might be able to explain those better
> than I can.

Consume is weaker than acquire. It is basically used for data-dependent 
loads. For instance, it can be used for RCU algorithms that do not need 
a full acquire barrier. Now, iirc, the only system that actually needs 
an explicit barrier for data-dependent loads is the dec alpha. Actually, 
it kind of seems like consume was meant for RCU like algos.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-03-30 08:57 +0000
  Re: Pre-main construction order in modules Richard Damon <richard@damon-family.org> - 2025-03-30 07:21 -0400
    Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 16:22 +0000
      Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-30 19:56 +0200
        Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 18:00 +0000
  Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-30 10:38 -0400
    Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-03-30 15:30 +0000
      Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 15:59 +0000
        Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-03-30 16:09 +0000
          Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 16:17 +0000
            Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-03-30 16:23 +0000
              Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 16:26 +0000
                Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-03-31 08:20 +0000
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-31 10:46 +0200
                Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-03-31 11:56 +0300
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-31 11:11 +0200
                Re: Pre-main construction order in modules Richard Damon <richard@damon-family.org> - 2025-03-31 07:25 -0400
                Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-03-31 15:26 +0300
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-31 14:32 +0200
                Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-03-31 15:44 +0300
                Re: Pre-main construction order in modules Jakob Bohm <egenagwemdimtapsar@jbohm.dk> - 2025-04-01 06:06 +0200
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-04-01 08:41 +0200
                Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-04-01 11:41 +0300
                Re: Pre-main construction order in modules Richard Damon <richard@damon-family.org> - 2025-03-31 07:22 -0400
              Re: Pre-main construction order in modules Richard Damon <richard@damon-family.org> - 2025-03-30 15:05 -0400
            Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-30 19:58 +0200
              Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 18:02 +0000
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-30 20:05 +0200
                Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 18:07 +0000
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-30 20:08 +0200
                Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 18:11 +0000
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-30 20:17 +0200
                Re: Pre-main construction order in modules Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-30 18:20 +0000
                Re: Pre-main construction order in modules Richard Damon <richard@damon-family.org> - 2025-03-30 15:01 -0400
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-30 22:15 +0200
                Re: Pre-main construction order in modules "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-03-30 13:57 -0700
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-31 07:37 +0200
                Re: Pre-main construction order in modules "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-03-31 21:54 -0700
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-04-01 08:41 +0200
                Re: Pre-main construction order in modules "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-04-01 00:00 -0700
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-04-01 11:42 +0200
                Re: Pre-main construction order in modules "Fred. Zwarts" <F.Zwarts@HetNet.nl> - 2025-04-01 12:00 +0200
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-04-01 14:16 +0200
                Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-04-01 16:03 +0200
      Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-03-31 11:49 +0300
        Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-03-31 09:09 +0000
          Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-03-31 15:39 +0300
            Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-03-31 14:01 +0000
              Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-03-31 20:06 +0300
              Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-31 19:42 -0400
                Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-04-01 07:26 +0000
                Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-04-01 11:48 +0300
                Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-04-01 08:57 +0000
                Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-04-01 12:21 +0300
                Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-04-01 10:08 +0000
                Re: Pre-main construction order in modules Michael S <already5chosen@yahoo.com> - 2025-04-01 13:12 +0300
                Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-04-01 10:23 +0000
                Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-04-01 10:27 +0000
                Re: Pre-main construction order in modules Michael S <already5chosen@yahoo.com> - 2025-04-01 13:20 +0300
                Re: Pre-main construction order in modules Paavo Helde <eesnimi@osa.pri.ee> - 2025-04-01 13:33 +0300
                Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-04-01 10:48 +0000
                Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-04-01 14:37 -0400
                Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-04-01 14:37 -0400
                Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-04-01 14:32 -0400
                Re: Pre-main construction order in modules "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-04-01 12:39 -0700
                Re: Pre-main construction order in modules Michael S <already5chosen@yahoo.com> - 2025-04-01 23:26 +0300
                Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-04-01 19:08 -0400
                Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-04-01 22:55 -0400
                Re: Pre-main construction order in modules Muttley@DastardlyHQ.org - 2025-04-02 07:34 +0000
        Re: Pre-main construction order in modules scott@slp53.sl.home (Scott Lurndal) - 2025-03-31 14:15 +0000
          Re: Pre-main construction order in modules Bonita Montero <Bonita.Montero@gmail.com> - 2025-03-31 16:47 +0200
      Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-03-31 10:29 -0400
        Re: Pre-main construction order in modules Jakob Bohm <egenagwemdimtapsar@jbohm.dk> - 2025-04-01 06:29 +0200
          Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-04-01 13:55 -0400
            Re: Pre-main construction order in modules Michael S <already5chosen@yahoo.com> - 2025-04-01 23:10 +0300
              Re: Pre-main construction order in modules Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-04-01 14:20 -0700
              Re: Pre-main construction order in modules James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-04-01 18:57 -0400
              Re: Pre-main construction order in modules David Brown <david.brown@hesbynett.no> - 2025-04-02 10:29 +0200

csiph-web