Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > pointer arithmetic question.

Reply
Thread Tools

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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pointer to pointer or reference to pointer A C++ 7 07-05-2011 07:49 PM
Pointer to pointer Vs References to Pointer bansalvikrant@gmail.com C++ 4 07-02-2009 10:20 AM
passing the address of a pointer to a func that doesnt recieve a pointer-to-a-pointer jimjim C Programming 16 03-27-2006 11:03 PM
Usual Arithmetic Conversions-arithmetic expressions joshc C Programming 5 03-31-2005 02:23 AM
Pointer-to-pointer-to-pointer question masood.iqbal@lycos.com C Programming 10 02-04-2005 02:57 AM



Advertisments