Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #1857
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Pre And Post Increment Operator Output |
| Date | 2012-06-22 21:35 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <js2l17$cd9$1@dont-email.me> (permalink) |
| References | <8404c4f1-a3b7-46b7-ad9c-17de265f9aee@googlegroups.com><js02hp$jsl$1@dont-email.me> <js03uf$sb3$1@dont-email.me><js092m$pov$1@dont-email.me> <lnipek8bri.fsf@nuthaus.mib.org><js1gf5$l7v$1@dont-email.me><0.06d3eacd14619c86d384.20120622143458BST.87ehp7o4fx.fsf@bsb.me.uk><js21jb$963$1@dont-email.me><7MudnTZhnIs6EnnSnZ2dnUVZ_qCdnZ2d@earthlink.com><js27pl$h7c$1@dont-email.me> <0.0b3aeb4b00dfdccbd115.20120622205336BST.87395nnmwv.fsf@bsb.me.uk> |
"Ben Bacarisse" <ben.usenet@bsb.me.uk> wrote in message news:0.0b3aeb4b00dfdccbd115.20120622205336BST.87395nnmwv.fsf@bsb.me.uk... > "BartC" <bc@freeuk.com> writes: >> "Patricia Shanahan" <pats@acm.org> wrote in message >>> On 6/22/2012 8:02 AM, BartC wrote: >>>> result of i=(++i)+(++i)+(++i), when i starts at 0 >>> In Java, i does have a specified resulting value. The effect will be the >>> same as i=3*i+6. >> >> So it ends up with i=6, when i starts at zero. The case for '6' is >> improving.. > > The case for 6 in Java is rock-solid. > > <snip> >> I suggested in comp.lang.c that the result of the above ought to be 6, >> in line with the original poster's expectations, (before going on to >> explain why it might not be in C), for which I was castigated and even >> called evil. > > Way to go BartC. Maybe the OP in the original thread had a Java background. Or maybe he just decided the common-sense result was 6, and wanted to know why C didn't agree. But I give up; you win. Clearly if someone sees such an expression, even before they go anywhere near an actual programming language, they have to assume that *expecting* a result such as 94613277, is just as plausible as expecting it to be as 6. (BTW how did Java, a C derivative, end up with well-defined semantics for this kind of expression? And why isn't the result 94613227, but... 6? Why choose 6? Because, after all, you guys keep telling me that i = (++i)+(++i)+(++i) is completely meaningless. Or is it conceivable that 6 does, after all, actually make more sense than 94613277..) Anyway, I'll leave you guys to it. -- Bartc
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar
Re: Pre And Post Increment Operator Output "BartC" <bc@freeuk.com> - 2012-06-22 16:02 +0100
Re: Pre And Post Increment Operator Output Patricia Shanahan <pats@acm.org> - 2012-06-22 08:30 -0700
Re: Pre And Post Increment Operator Output "BartC" <bc@freeuk.com> - 2012-06-22 17:49 +0100
Re: Pre And Post Increment Operator Output Patricia Shanahan <pats@acm.org> - 2012-06-22 10:36 -0700
Re: Pre And Post Increment Operator Output "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-06-23 09:57 +0100
Re: Pre And Post Increment Operator Output Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-22 20:53 +0100
Re: Pre And Post Increment Operator Output "BartC" <bc@freeuk.com> - 2012-06-22 21:35 +0100
Re: Pre And Post Increment Operator Output Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-22 23:19 +0100
Re: Pre And Post Increment Operator Output "BartC" <bc@freeuk.com> - 2012-06-23 01:15 +0100
Re: Pre And Post Increment Operator Output Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-22 17:44 +0100
csiph-web