template <typename T> staticvoid CheckOverflow(T expected, constchar* value, bool should_overflow) {
std::stringstream ss(value);
T result = T(0);
ss >> result;
EXPECT_FALSE(ss.bad()) << value << ' ' << int64_t(result);
EXPECT_EQ(should_overflow, ss.fail()) << value << ' ' << int64_t(result); if (!should_overflow) { // glibc writes garbage on overflow.
ASSERT_EQ(expected, result) << value;
}
}
TEST(sstream, __get_integer_overflow_8) { // The usual byte/char confusion means that operator>> on 8-bit types is used // for chars, so there's no possibility of overflow.
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.