Re: What is a sequence point?
From: Mark McIntyre (markmcintyre_at_spamcop.net)
Date: 02/11/05
- Next message: Mark McIntyre: "Re: What is a sequence point?"
- Previous message: Mark McIntyre: "Re: how can I test for backspace if( (c = getchar()) == '\b' )"
- In reply to: Luke Wu: "Re: What is a sequence point?"
- Next in thread: Dave Vandervies: "Re: What is a sequence point?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 11 Feb 2005 22:30:48 +0000
On 11 Feb 2005 12:55:34 -0800, in comp.lang.c , "Luke Wu"
<LookSkywalker@gmail.com> wrote:
>
>infobahn wrote:
>> So what? The compiler can view it this way:
>>
>> "We have an expression of the form a = b = c; fine, I'll make them
>> all equal, so we'll set a equal to c and we'll set b equal to c",
>> so it could set p equal to q and then set p->next equal to q, with
>> the result that q->next = q;
>>
>No, the compiler views it according to the associativity rules(right to
>left) as this:
>
>(a = (b = c)) <=== right to left associativity
The standard discusses this type of problem. In 5.1.2.3, it shows examples
and notes that in general you cannot assume the normal mathematical laws of
associativity to be applicable.
-- Mark McIntyre CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html> CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
- Next message: Mark McIntyre: "Re: What is a sequence point?"
- Previous message: Mark McIntyre: "Re: how can I test for backspace if( (c = getchar()) == '\b' )"
- In reply to: Luke Wu: "Re: What is a sequence point?"
- Next in thread: Dave Vandervies: "Re: What is a sequence point?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|