Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #691
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe11.iad.POSTED!00000000!not-for-mail |
|---|---|
| From | David Lamb <dalamb@cs.queensu.ca> |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.help |
| Subject | Re: Why would one use += 1 at the place of ++? |
| References | <8762p7upgn.fsf@merciadriluca-station.MERCIADRILUCA> |
| In-Reply-To | <8762p7upgn.fsf@merciadriluca-station.MERCIADRILUCA> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Lines | 13 |
| Message-ID | <4t6Bp.534$pi2.511@newsfe11.iad> (permalink) |
| NNTP-Posting-Host | 67.193.237.254 |
| X-Complaints-To | abuse@cogeco.net |
| X-Trace | newsfe11.iad 1305801664 67.193.237.254 (Thu, 19 May 2011 10:41:04 UTC) |
| NNTP-Posting-Date | Thu, 19 May 2011 10:41:04 UTC |
| Date | Thu, 19 May 2011 06:40:56 -0400 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.help:691 |
Show key headers only | View raw
On 19/05/2011 3:19 AM, Merciadri Luca wrote:
> I've heard that it is generally better to use += 1 at the place of ++. For me,
> they do exactly the same thing, maybe except that the former is
> actually splitted into different atomic operations, when the latter
> might be done in an atomic operation?
I think ++ exists only because the hardware on which C was developed had
an addressing mode that did it atomically in the very special case of
referring to
something = array[index++];
I have no idea what goes on with the Java byte code specifically (ie
whether ++ is defined to be atomic) but any decent optimizer ought to
treat x++ and x +=1 each in whatever way is optimal.
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar
Why would one use += 1 at the place of ++? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-05-19 09:19 +0200
Re: Why would one use += 1 at the place of ++? Bent C Dalager <bcd@pvv.ntnu.no> - 2011-05-19 10:22 +0000
Re: Why would one use += 1 at the place of ++? David Lamb <dalamb@cs.queensu.ca> - 2011-05-19 06:40 -0400
Re: Why would one use += 1 at the place of ++? Jeff Higgins <jeff@invalid.invalid> - 2011-05-19 07:58 -0400
[OT] Re: Why would one use += 1 at the place of ++? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-19 08:03 -0400
Re: [OT] Re: Why would one use += 1 at the place of ++? Patricia Shanahan <pats@acm.org> - 2011-05-19 07:35 -0700
Re: [OT] Re: Why would one use += 1 at the place of ++? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-19 22:57 -0400
Re: [OT] Re: Why would one use += 1 at the place of ++? rossum <rossum48@coldmail.com> - 2011-05-20 11:00 +0100
Re: [OT] Re: Why would one use += 1 at the place of ++? Patricia Shanahan <pats@acm.org> - 2011-05-20 12:55 -0700
Re: [OT] Re: Why would one use += 1 at the place of ++? David Lamb <dalamb@cs.queensu.ca> - 2011-05-19 17:58 -0400
Re: [OT] Re: Why would one use += 1 at the place of ++? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-19 23:13 -0400
Re: Why would one use += 1 at the place of ++? Lew <noone@lewscanon.com> - 2011-05-19 08:43 -0400
Re: Why would one use += 1 at the place of ++? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-19 07:51 -0400
Re: Why would one use += 1 at the place of ++? Jeff Higgins <jeff@invalid.invalid> - 2011-05-19 08:03 -0400
Re: Why would one use += 1 at the place of ++? Lew <noone@lewscanon.com> - 2011-05-19 08:08 -0400
Re: Why would one use += 1 at the place of ++? Roedy Green <see_website@mindprod.com.invalid> - 2011-05-19 10:23 -0700
Re: Why would one use += 1 at the place of ++? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-05-19 21:15 +0200
Re: Why would one use += 1 at the place of ++? Lew <noone@lewscanon.com> - 2011-05-19 15:29 -0400
csiph-web