On Hp UX with aCC compiler:
#include
#include
using namespace std;
int main () {
if (sizeof(int)==sizeof(long)){
cout<<"sizeof int == sizeof long"<::max()==numeric_limits::max()){
cout<<"INT_MAX == lONG_MAX"<::max() << endl;
cout << "Maximum value for long: " << numeric_limits::max() << endl;
return 0;
}
It prints:
sizeof int == sizeof long
INT_MAX != LONG_MAX
I checked both int and long types are 4bytes.
manpage limits(5) says that INT_MAX and LONG_MAX are both 2147483647
http://nixdoc.net/man-pages/HP-UX/man5/limits.5.html
So, conclusion std::numeric_limits< type >:: is not portable.