I'm doing some integer overflow checking in C++ using the Android NDK. For space reasons, I can't use the full C++ stdlib, so I can't use std::numeric_limits<int>::max()
, as suggested here.
What is my best alternative?
I'm doing some integer overflow checking in C++ using the Android NDK. For space reasons, I can't use the full C++ stdlib, so I can't use std::numeric_limits<int>::max()
, as suggested here.
What is my best alternative?
Use the static STL instead of the shared one. Only the pieces you use will be included in your app and the linker will strip the rest.
I fixed the issue by copying and hardcoding the limit values from limits.h
.