-1

Linux 2.6.32

Intel compiler: icpc version 13.0.1 (gcc version 4.4.6 compatibility)

#include <iostream>
#include <sys/types.h>
int main()
{
    std::cerr << sizeof (__uint128_t) << std::endl;     
    return 0;
}

Output: 16

So, type __uint128_t exists.
However, working with __uint128_t produces compilation and run errors.

Programs:

// 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;
}

Compilations:

icpc int01.cpp

/usr/include/c++/4.4.6/c++0x_warning.h(31): catastrophic error: #error directive: This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options. #error This file requires compiler and library support for the upcoming \ ^

compilation aborted for int01.cpp (code 4)

icpc int01.cpp -std=c++0x

int01.cpp(4): error: identifier "uint128_t" is undefined uint128_t val128 = 0; ^

compilation aborted for int01.cpp (code 2)

icpc int02.cpp -std=c++0x

// No errors

icpc int03.cpp -std=c++0x

int03.cpp(6): error: more than one operator "<<" matches these operands:

        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;
          ^

compilation aborted for int03.cpp (code 2)

Do you have any suggestions?

Alex
  • 133
  • 1
  • 10
  • 7
    What compilation errors? From what code? What runtime errors? – Mat Mar 13 '13 at 10:06
  • 1
    What compilation command? Which libraries are linked? It should be `uint128_t` not `__uint128_t` with `#include ` or better `#include ` (in C++) – Basile Starynkevitch Mar 13 '13 at 10:10
  • @BasileStarynkevitch Interestingly I can not seem to get `uinit128_t` to work on any compilers on Live Work Space although they all accept `__uint128_t`, this previous post seems to indicate it is experimental and platform dependent http://stackoverflow.com/a/11660651/1708801 – Shafik Yaghmour Mar 13 '13 at 12:27

1 Answers1

0

As for 1) and 2) everything I read basically says that this is experimental and platform dependent. Although @Basile suggested that it should be uint128_t I can not find a compiler Intel, gcc nor clang that support anything but __uint128_t, you can try out various compilers at Live Work Space. This is my attempt at this problem.

As for 3) it would seem that there is no version of of these streams that support __uint128_t since it is experimental perhaps that should be surprising. This previous thread how to print __uint128_t number using gcc? shows some alternatives.

Is there any reason why you don't explore some of the Bigint libraries out there?

Community
  • 1
  • 1
Shafik Yaghmour
  • 154,301
  • 39
  • 440
  • 740