boostorg / sort

Boost.Sort
51 stars 45 forks source link

Warnings in float_sort_test #18

Closed pdimov closed 6 years ago

pdimov commented 6 years ago
test\float_sort_test.cpp(86): warning C4146: unary minus operator applied to unsigned type, result still unsigned
test\float_sort_test.cpp(119): warning C4146: unary minus operator applied to unsigned type, result still unsigned

These are emitted by

  // Trying both positive and negative sorted and reverse sorted data.
  base_vec.clear();
  for (size_t i = 0; i < input_count; ++i) base_vec.push_back(-i);

The comment implies that negative values are supposed to be tested, but -i when i is size_t does not result in a negative number, but in a large positive one.

Looks like for (int i = 0; ... is intended.

spreadsort commented 6 years ago

Thanks for the report! It should be fixed now.