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


Groups > comp.lang.c > #20605

Re: pointer arithmetic question.

From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.lang.c
Subject Re: pointer arithmetic question.
Date 2012-05-11 17:52 +0000
Organization Aioe.org NNTP Server
Message-ID <20120511102332.36@kylheku.com> (permalink)
References (3 earlier) <kfnbolyx08z.fsf@x-alumni2.alumni.caltech.edu> <20120508061850.883@kylheku.com> <kfnwr4mziir.fsf@x-alumni2.alumni.caltech.edu> <20120509134506.486@kylheku.com> <kfn1ums7ypg.fsf@x-alumni2.alumni.caltech.edu>

Show all headers | View raw


On 2012-05-10, Tim Rentsch <txr@alumni.caltech.edu> wrote:
> Kaz Kylheku <kaz@kylheku.com> 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.

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


Thread

pointer arithmetic question. somenath <somenathpal@gmail.com> - 2012-05-05 21:46 -0700
  Re: pointer arithmetic question. Philip Lantz <prl@canterey.us> - 2012-05-05 23:25 -0700
    Re: pointer arithmetic question. Paul N <gw7rib@aol.com> - 2012-05-06 07:52 -0700
  Re: pointer arithmetic question. Kaz Kylheku <kaz@kylheku.com> - 2012-05-06 06:58 +0000
  Re: pointer arithmetic question. pete <pfiland@mindspring.com> - 2012-05-06 08:53 -0400
    Re: pointer arithmetic question. pete <pfiland@mindspring.com> - 2012-05-08 06:35 -0400
      Re: pointer arithmetic question. Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-08 06:37 -0700
        Re: pointer arithmetic question. Kaz Kylheku <kaz@kylheku.com> - 2012-05-08 14:32 +0000
          Re: pointer arithmetic question. Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-08 10:31 -0700
            Re: pointer arithmetic question. Kaz Kylheku <kaz@kylheku.com> - 2012-05-09 21:04 +0000
              Re: pointer arithmetic question. Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-10 10:06 -0700
                Re: pointer arithmetic question. Kaz Kylheku <kaz@kylheku.com> - 2012-05-11 17:52 +0000
                Re: pointer arithmetic question. Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-11 19:27 -0700

csiph-web