Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9042
| Date | 2011-10-20 18:22 +0100 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: A freshman's question |
| References | <3242b80f-ee51-45f0-9e12-231482f61a97@r2g2000prh.googlegroups.com> <37KdnWZAYfIR1QPTnZ2dnUVZ_vWdnZ2d@earthlink.com> <j7pbaa$92n$1@dont-email.me> <r7l0a7tnf16mukam36n816b6t4jed0p34g@4ax.com> |
| Message-ID | <BY2dne2NirN2xT3TnZ2dnUVZ_h6dnZ2d@earthlink.com> (permalink) |
Gene Wirchenko wrote: > On Thu, 20 Oct 2011 07:30:31 -0700, Travers Naran <tnaran@gmail.com> > wrote: > > [snip] > >> This is off topic, but I just recently learned that in C++, the result >> of i=i++ is officially undefined. It's interesting a question related >> to what I learned comes up again in a completely different forum. > > That comes from C. I have a question for anyone thinking it > valid Java. What is it supposed to do of use? (If nothing, why even > use it?) I suspect the whole thing got started by someone not > understanding that ++ causes an assignment to occur. i = i++; is definitely valid Java, and actual compiler behavior matches the results the JLS requires for it. Preventing it, but allowing any use of the i++ result would require some messy rules. That does not mean it is a good idea. In early C code, there was a tendency to try to stuff as much as possible into a single expression. I don't know the causes - I suspect some combination of macros and trying to avoid fetching a recently calculated result from memory. Neither should be a concern in Java. Patricia
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-18 20:08 -0700
Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-19 04:48 +0100
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-19 00:54 -0700
Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-19 09:20 +0100
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-19 03:38 -0700
Re: A freshman's question Lars Enderin <lars.enderin@telia.com> - 2011-10-19 17:48 +0200
Re: A freshman's question Tim Slattery <Slattery_T@bls.gov> - 2011-10-19 12:24 -0400
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 03:55 -0700
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 03:50 -0700
Re: A freshman's question Lew <lewbloch@gmail.com> - 2011-10-19 09:58 -0700
Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-19 18:47 +0100
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 03:48 -0700
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-19 03:49 -0700
Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-19 18:58 +0100
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 02:13 -0700
Re: A freshman's question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-10-19 06:05 -0300
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-19 03:38 -0700
Re: A freshman's question Travers Naran <tnaran@gmail.com> - 2011-10-20 07:30 -0700
Re: A freshman's question Gene Wirchenko <genew@ocis.net> - 2011-10-20 10:08 -0700
Re: A freshman's question Patricia Shanahan <pats@acm.org> - 2011-10-20 18:22 +0100
Re: A freshman's question Lew <lewbloch@gmail.com> - 2011-10-20 13:59 -0700
Re: A freshman's question Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-10-20 17:38 -0500
Re: A freshman's question Roedy Green <see_website@mindprod.com.invalid> - 2011-10-19 23:56 -0700
Re: A freshman's question whl <wanghailunmail@gmail.com> - 2011-10-20 03:55 -0700
csiph-web