git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: clean up int cast warning found with Xcode
commit2f95c791c24081a42640b44e4add83f27c1e0ba0 authorAndy Arvanitis <andyarvanitis@gmail.com> dateMon 14 Nov 2016, 11:57 (10 years ago) parentad15de2
1 file changed+4−3
pcc/runtime/purescript.hh+4−3
pcc/runtime/purescript.hh+4−3
@@ -19,7 +19,7 @@
1919
2020#if defined(DEBUG)
2121 #include <cassert>
22− #include <climits>
22+ #include <limits>
2323 #define IF_DEBUG(x) x
2424#else
2525 #define NDEBUG
@@ -165,8 +165,9 @@ class any {
165165 public:
166166
167167 any(const int val) noexcept : tag(tag_t::Integer), i(val) {}
168− any(const long int_value) noexcept : tag(tag_t::Integer), i(int_value) {
169− assert(int_value >= INT_MIN && int_value <= INT_MAX);
168+ any(const long val) noexcept : tag(tag_t::Integer), i(static_cast<decltype(i)>(val)) {
169+ assert(val >= std::numeric_limits<decltype(i)>::min() &&
170+ val <= std::numeric_limits<decltype(i)>::max());
170171 }
171172
172173 any(const double val) noexcept : tag(tag_t::Double), d(val) {}