Linux 2.6.32
Intel编译器:icpc 13.0.1版(gcc 4.4.6版兼容)
#include <iostream>
#include <sys/types.h>
int main()
{
std::cerr << sizeof (__uint128_t) << std::endl;
return 0;
}
输出:16
所以,类型__uint128_t
存在。
但是,使用__uint128_t
会产生编译和运行错误。
程式:
// File int01.cpp
#include <cstdint>
int main()
{
uint128_t val128 = 0;
return 0;
}
// File int02.cpp
#include <cstdint>
int main()
{
__uint128_t val128 = 0;
return 0;
}
// File int03.cpp
#include <iostream>
#include <cstdint>
int main()
{
__uint128_t val128 = 0;
std::cerr << val128 << std::endl;
return 0;
}
汇编:
icpc int01.cpp
/usr/include/c++/4.4.6/c++0x_warning.h(31):灾难性错误:#error 指令:此文件需要编译器和库支持即将推出的 ISO C++ 标准 C++0x。此支持目前是实验性的,必须使用 -std=c++0x 或 -std=gnu++0x 编译器选项启用。#error 此文件需要编译器和库支持,以支持即将推出的 \ ^
int01.cpp 的编译中止(代码 4)
icpc int01.cpp -std=c++0x
int01.cpp(4):错误:标识符“uint128_t”未定义 uint128_t val128 = 0; ^
int01.cpp 的编译中止(代码 2)
icpc int02.cpp -std=c++0x
// 没有错误
icpc int03.cpp -std=c++0x
int03.cpp(6):错误:多个运算符“<<”匹配这些操作数:
function "std::basic_ostream<_CharT, _Traits>::operator<<(long) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned long) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(short) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned short) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(long long) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned long long) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT=char, _Traits=std::char_traits<char>]"
function "std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT=char, _Traits=std::char_traits<char>]"
operand types are: std::ostream << __uint128_t
std::cerr << val128 << std::endl;
^
int03.cpp 的编译中止(代码 2)
你有什么建议吗?