Velocity Reviews > pointer arithmetic question.

# pointer arithmetic question.

Tim Rentsch
Guest
Posts: n/a

 05-12-2012
Kaz Kylheku <(E-Mail Removed)> writes:

> On 2012-05-10, Tim Rentsch <(E-Mail Removed)> wrote:
>> Kaz Kylheku <(E-Mail Removed)> writes:
>>> 2. Or else "after the assignment" literally means after the
>>> complete assignment (side effect and all). This means that the
>>> expression's value is not available until the side effect
>>> completes.

>>
>> The Standard does not guarantee this. That's why assignments like
>>
>> a[i] = a[j] = 7;
>>
>> have undefined behavior when i == j;

>
> Well, the sequencing (i.e sequence point: same thing, as I contend) is between
> the evaluation of a[j] and 7, and the assignment. It is not "intervening"
> between the update of a[j] and a[i].
>
> This doesn't show "sequenced before" is a different concept from "sequence
> point".
>
> Exactly like "sequenced before", sequenced points can be localized within a
> subexpression, so that they do not intervene between unrelated evaluations in
> the surrounding full expression. This is well-known via the example (A, B) +
> (C, D) where neither sequence point intervenes between A and D. (We don't even
> know whether A is evaluated first or D, or whether they are interleaved.)
>
> A sequence point doesn't mean that all effects are settled and no new ones
> begin; just those in the scope of the operation to which the particular
> sequence point immediately belongs, which can be "comma operator" or "full
> expression", etc.

The problem with these descriptions is that how you are using the
terminology doesn't correspond to how the Standard defines them.
If there is a sequence point between expression A and expression B,
every value computation and every side-effect of expression A is
sequenced before every value computation and every side-effect of
expression B. This usage corresponds to how C99 uses the term
sequence point (although C11 defines the term more carefully, in
terms of the 'sequenced before' relationship). As far as the
Standard is concerned, there is no such thing as a 'sequence point'
that defines a sequencing relationship for value computations but
not for side-effects; the Standard defines the term so that it
always includes both.