Commit b6c430e1 authored by Jim Meyering's avatar Jim Meyering Committed by Viswanath Sivakumar

folly/FBVector.h: avoid -Wsign-compare error (simple)

Summary:
* folly/FBVector.h (make_window): Declare "tail" to be
explicitly of the same type as "n".  Otherwise, we'd
use the type of std::distance, which is unsigned, and
then compare that against "n" of type "size_type", which
is unsigned, and we'd get this from gcc-4.9:
folly/FBVector.h:1276:14: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

Test Plan:
Run this and note there are fewer errors than before:
fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo

Reviewed By: philipp@fb.com, andrei.alexandrescu@fb.com

Subscribers: trunkagent, njormrod, folly-diffs@

FB internal diff: D1768346

Tasks: 5941250

Signature: t1:1768346:1420594452:654dac805bb46f7c6a38b4e4102e4004720d6835
parent c7e25e1a
......@@ -1271,7 +1271,8 @@ private: // we have the private section first because it defines some macros
assert(size() + n <= capacity());
assert(n != 0);
auto tail = std::distance(position, impl_.e_);
// The result is guaranteed to be non-negative, so use an unsigned type:
size_type tail = std::distance(position, impl_.e_);
if (tail <= n) {
relocate_move(position + n, position, impl_.e_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment