avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] OT Generic C question


From: Alan Kilian
Subject: Re: [avr-gcc-list] OT Generic C question
Date: Thu, 22 Sep 2005 14:00:28 -0500

On Thu, 2005-09-22 at 19:12 +0100, Richard Urwin wrote:
> There is a sequence point immediately before the assignment.
> So, far from being a compiler bug, this is absolutely correct behaviour. 
> Anything else would be a bug.
> 
> 1) The value of i is taken (0)
> 2) i is incremented (to 1)
> ---- sequence point---
> 3) i is set to the value taken (0)


    Richard,

        Can you explain how you came to the conclusion that there is
        a sequence point before the assignment?

        Here's an excerpt from:
http://publications.gbdirect.co.uk/c_book/chapter8/sequence_points.html

        "This is why you cannot rely on expressions such as:
        a[i] = i++;
        because there is no sequence point specified for the 
        assignment, increment or index operators, you don't know when 
        the effect of the increment on i occurs. "

        That section seems to imply that the compiler is NOT broken.

        I certainly may be reading this section incorrectly, or it may
        be subtly different from the original problem.

        I just want to understand a little more.

                                -Alan

-- 
- Alan Kilian <kilian(at)bobodyne.com>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]