Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Jan 1999 20:35:55 +1000 (EST)
From:      Andrew Kenneth Milton <akm@zeus.theinternet.com.au>
To:        dcs@newsguy.com (Daniel C. Sobral)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: some weird C
Message-ID:  <199901311035.UAA28754@zeus.theinternet.com.au>
In-Reply-To: <36B41674.2E66D8EC@newsguy.com> from "Daniel C. Sobral" at "Jan 31, 99 05:38:12 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
+----[ Daniel C. Sobral ]---------------------------------------------
| Andrew Kenneth Milton wrote:
| > 
| > +----[ Malartre ]---------------------------------------------
| > |
| > | I was expecting 9, not 10.
| > | since 4+5=9?
| > 
| > x is pre-incremented, making it 5 *before* the += takes effect.
| > 
| > This is correct behaviour.
| 
| Explain the 8 then... if x++ takes effect *after* +=, it should have
| been 9, right?

No. the time at which a post increment operation takes place is
undefined, but, before the next *expression*


-- 
Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   |  Andrew
The Internet (Aust) Pty Ltd          |  F:+61 7 3870 4477   |  Milton
ACN: 082 081 472                     |  M:+61 416 022 411   |72 Col .Sig
PO Box 837 Indooroopilly QLD 4068    |akm@theinternet.com.au|Specialist

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901311035.UAA28754>