Re: What is a sequence point?
From: pete (pfiland_at_mindspring.com)
Date: 02/11/05
- Next message: Jack Klein: "Re: Is "scope" different from "visibility" ?"
- Previous message: Mike Wahler: "Re: Is "scope" different from "visibility" ?"
- In reply to: Deniz Bahar: "What is a sequence point?"
- Next in thread: Luke Wu: "Re: What is a sequence point?"
- Reply: Luke Wu: "Re: What is a sequence point?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 11 Feb 2005 05:56:20 GMT
Deniz Bahar wrote:
>
> I know the basic definition of a sequence point (point where all side
> effects guaranteed to be finished), but I am confused about this
> statement:
>
> "Between the previous and next sequence point an object shall have its
> stored value modified at most once by the evaluation of an expression.
> Furthermore, the prior value shall be accessed only to determine the
> value to be stored."
>
> Can someone give me examples of expressions that "barely" break this
> rule (the type a newcomer might trip over)?
>
> If you are between sequence points,
> then what does that second sentence
> mean "prior value"?
(p = p -> next = q)
The above doesn't specify the order of assignment and is undefined.
It could be either (p = q, p -> next = q) or (p -> next = q, p = q).
(i = x[i]++)
The above is being debated on comp.std.c
The i in x[i]++ is evaluated only once, but for two reasons.
It's evaluated to determine the value of the right operand of
the assignment operator, but also to determine the address of
the lvalue of the increment operator.
-- pete
- Next message: Jack Klein: "Re: Is "scope" different from "visibility" ?"
- Previous message: Mike Wahler: "Re: Is "scope" different from "visibility" ?"
- In reply to: Deniz Bahar: "What is a sequence point?"
- Next in thread: Luke Wu: "Re: What is a sequence point?"
- Reply: Luke Wu: "Re: What is a sequence point?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|