Topic: What's a "side effect
Author: Andy Lutomirski <luto@amacapital.net>
Date: Fri, 5 Oct 2012 02:35:23 CST
Raw View
I'm trying to userstand the memory model. [intro.multithread] mentions
lots of things like:
A release sequence ... is a maximal contiguous sub-sequence of side effects
I know what a /visible/ side effect is (see #13), but that doesn't tell
me what a side effect is in the first place. I assume that a "side
effect" is just a write (e.g. "a = b" has a side effect of modifying a),
but AFAICS the N3376 has no language to support that assumption.
Am I right? Should I submit a defect report?
Thanks,
Andy
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: James Kuyper <jameskuyper@verizon.net>
Date: Sun, 7 Oct 2012 07:43:20 -0700 (PDT)
Raw View
On 10/05/2012 04:35 AM, Andy Lutomirski wrote:
>
> I'm trying to userstand the memory model. [intro.multithread] mentions
> lots of things like:
>
> A release sequence ... is a maximal contiguous sub-sequence of side effects
>
> I know what a /visible/ side effect is (see #13), but that doesn't tell
> me what a side effect is in the first place. I assume that a "side
> effect" is just a write (e.g. "a = b" has a side effect of modifying a),
> but AFAICS the N3376 has no language to support that assumption.
>
> Am I right? Should I submit a defect report?
You're right - the expression "a = b" does have a side effect, which is
the modification of the object identified by "a" (unless a very peculiar
operator overload applies). However, there are other kinds of side
effects that don't fit your description:
"Accessing an object designated by a volatile glvalue (3.10), modifying
an object, calling a library I/O function, or calling a function that
does any of those operations are all side effects, ..." (1.9p12) The
phrase "side effects" is italicized in that sentence, which is an ISO
convention for indicating that the sentence containing that phrase
constitutes the definition of that phrase.
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: =3D?ISO-8859-1?Q?Daniel_Kr=3DFCgler?=3D
Date: Mon, 8 Oct 2012 09:11:55 -0700 (PDT)
Raw View
[2nd attempt after three days]
On 2012-10-05 10:35, Andy Lutomirski wrote:
>
> I'm trying to userstand the memory model. [intro.multithread] mentions
> lots of things like:
>
> A release sequence ... is a maximal contiguous sub-sequence of side
effects
>
> I know what a /visible/ side effect is (see #13), but that doesn't tell
> me what a side effect is in the first place. I assume that a "side
> effect" is just a write (e.g. "a = b" has a side effect of modifying a=
),
> but AFAICS the N3376 has no language to support that assumption.
I think that the current wording defines what a /side effect/ is. This
is specified in [intro.execution] p12:
"Accessing an object designated by a volatile glvalue (3.10), modifying
an object, calling a library I/O function, or calling a function that
does any of those operations are all /side effects/, which are changes
in the state of the execution environment. Evaluation of an expression
(or a sub-expression) in general includes both value computations
(including determining the identity of an object for glvalue evaluation
and fetching a value previously assigned to an object for prvalue
evaluation) and initiation of side effects. When a call to a library I/O
function returns or an access to a volatile object is evaluated the side
effect is considered complete, even though some external actions implied
by the call (such as the I/O itself) or by the volatile
access may not have completed yet."
HTH & Greetings from Bremen,
Daniel Kr=FCgler
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]