2012年(158)
分类: C/C++
2012-11-23 16:45:21
// In VS200X: use /J to Changes the default
char type from signed char to unsigned char
// In g++ : use -funsigned-char
to ...
#include
#include
using
namespace std;
int main()
{
#ifndef _CHAR_UNSIGNED
cout << "not defined _CHAR_UNSIGNED" << endl;
#else
cout <<
"defined _CHAR_UNSIGNED" << endl; // output this word
#endif
cout << CHAR_MAX << endl; // output 255
cout << CHAR_MIN << endl;
// output 0
cout << "char_max = "
<< (int)numeric_limits<char>::max() << endl; // output 127 ( error )
cout << "char_min = " << (int)numeric_limits<char>::min() << endl; //
output 128 ( error )
return 0;
}
/*
查看了一下其库代码,完全正确。
错误发生在 #include
*/