Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.help Subject: Re: Why would one use += 1 at the place of ++? Date: Thu, 19 May 2011 08:03:20 -0400 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: <8762p7upgn.fsf@merciadriluca-station.MERCIADRILUCA> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 19 May 2011 12:00:38 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="66+B4XK2fUYI7mQKoMaOgA"; logging-data="19382"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JR2v0C34zPL6N7+IFdy69h1CGdhj5ktM=" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: <8762p7upgn.fsf@merciadriluca-station.MERCIADRILUCA> Cancel-Lock: sha1:nt/Z3nRnsrNhyYtwPFQ9wynxhC8= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:694 On 05/19/2011 03:19 AM, Merciadri Luca wrote: > Hi, > > I've heard that it is generally better to use += 1 at the place of ++. Specifically better here: String s = "0 + 1 = "; s += 1; Maybe someone can come up with a specific case where the increment operator is better. 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? > > Thanks.