int128 error

Touros Spoon
Sun Jan 2 16:24:00 GMT 2011

I have been trying to use the gcc extension __int128, but although I am able 
to declare a variable, when I test it by assigning a value, gcc warns me: 
"constant value is too large for its type".

I am using gcc 4.4.4 on 64 bit Slackware 13.1 with a core 2 duo processor.

This is the code Im using to test it:

#include <iostream>

int main ()


    __int128_t wibble;


    std::cout << "size of wibble: " << sizeof(wibble) << std::endl;

    return 0;


Unless Im mistaken, the maximum value that a signed int128 should be able to 
cope with is 170141183460469231731687303715884105727. However I tried 
knocking off a few digits to see what happened and the compiler is still 
complaining. The output of the above program displays a sizeof result of 16 
for "wibble" indicating that it is seeing __int128_t as a 16 byte (128 bit) 
integer. So I guess the problem is with the assignment, perhaps something 
Ive missed?

I put this on the gcc list because although it is probably a c++ problem, 
the only resources I can find relevant to this are related to external math 
Has anyone else come accross this problem / can see what I have done wrong 
and if so, please can you advise.


More information about the Gcc-help mailing list