On Tue, Dec 20, 2011 at 1:42 PM, Philip Martin
<philip.martin_at_wandisco.com> wrote:
> Mark Phippard <markphip_at_gmail.com> writes:
>
>> We have had a few users report a weird error that looks like they are
>> getting an ArrayIndexOutOfBoundsException except that it appears that
>> it is coming out of the native code. This happens during an update
>> operation. I am going to paste some of the native code in here, in
>> case anyone sees anything in the array handling that looks wrong. The
>> use of ++i instead of i++ looks odd to me, but I am not a C++
>> programmer and the general code patterns.
>
> ++i and i++ are equivalent in this case, and likely to be identical
> after optimisation.
More generally, the prefix-increment/decrement operation is more
efficient on some data types, namely iterators. While it may not
matter in the above case, a typical C++ pattern is to use the prefix
version to account for the cases when it does.
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2011-12-21 15:29:50 CET