RFR: 8185757: QuickSort array size should be size_t
Thomas Schatzl
thomas.schatzl at oracle.com
Thu Aug 3 12:35:14 UTC 2017
Hi again,
On Thu, 2017-08-03 at 14:32 +0200, Thomas Schatzl wrote:
> Hi Kim,
>
> On Wed, 2017-08-02 at 19:29 -0400, Kim Barrett wrote:
> >
> > Please review this change of the type of QuickSort::sort size
> > parameter from int to size_t, and propogating this change
> > throughoutthe QuickSort implementation (using size_t rather than
> > int sizes and indices) and tests.
> >
> > Since I was touching the QuickSort code anyway, I made a couple of
> > additional changes.
> >
> > - Re-ordered the internal template parameters, moving "idempotent"
> > to the front and allowing the array element type and the comparator
> > type to be deduced.
> >
> > - Changed the handling of the result of calling the comparator,
> > only
> > requiring it to return negative, zero, or positive, rather than
> > exactly -1, 0, or +1. This makes it consistent with the standard
> > library function qsort.
> Not sure if the change of the do-while to the for-loops improves
> readability that much.
> However, please put the closing brackets of these into extra lines
> (quicksort.hpp:76,77) to avoid the casual reader to overlook them.
forgot to mention: looks good apart from that. Do not need a re-review
for changing this.
Thanks,
Thomas
More information about the hotspot-runtime-dev
mailing list