Smallest values for int8_t and int64_t
c++
Solution
It's like the compiler says, `-9223372036854775808` is not a valid number because the `-` and the digits are treated separately.
You could try `-9223372036854775807 - 1` or use `std::numeric_limits<int64_t>::min()` instead.
Problem
With regard to to those definitions found in `stdint.h`, I wish to test a function for converting vectors of `int8_t` or vectors of `int64_t` to vectors of `std::string`. Here are my tests: ``` TEST(TestAlgorithms, toStringForInt8) { std::vector<int8_t> input = boost::assign::list_of(-128)(0)(127); Container container(input); EXPECT_TRUE(boost::apply_visitor(ToString(),container) == boost::assign::list_of("-128")("0")("127")); } TEST(TestAlgorithms, toStringForInt64) { std::vector<int64_t> input = boost::assign::list_of(-9223372036854775808)(0)(9223372036854775807); Container container(input); EXPECT_TRUE(boost::apply_visitor(ToString(),container) == boost::assign::list_of("-9223372036854775808")("0")("9223372036854775807")); } ``` However, I am getting a warning in visual studio for the line: ``` std::vector<int64_t> input = boost::assign::list_of(-9223372036854775808)(0)(9223372036854775807); ``` as follows: ``` warning C4146: unary minus operator applied to unsigned type, result still unsigned ``` If I change -9223372036854775808 to -9223372036854775807, the warning disappears. What is the issue here? With regard to my original code, the test is passing.