How to enable __int128 on Visual Studio?

When I type __int128 in a C++ project in Visual Studio, the editor changes color of __int128 to blue (like keyword).

But when I compile the source, the folowing error appears:

error C4235: 
nonstandard extension used : '__int128' keyword not supported on this architecture

How can I enable __int128 on Visual Studio?


MSDN doesn't list it as being available, and this recent response agrees, so officially, no, there is no type called __int128 and it can't be enabled.

Additionally, never trust the syntax hilighter; it is user editable, and thus likely to either have bogus or 'future' types in it. (it is probably a reserved word however, due to the error, thus you should avoid naming any types __int128, this follows the convention that anything prefixed with a double underscore should reserved for compiler use).

One would think the __int128 might be available on x64/IPF machines via register spanning, like __in64 is on 32bit targets, but right now the only 128 bit types stem from SIMD types (__m128 and its various typed forms).


There is a new version of _int128 which solves some of the problems mentioned. It includes a natvis addin, so you can view int128 in the debugger. To do this it was nessecary to write an x86 version of int128, because natvis-dll's need to be win32. The idea of using af template for the members lo,hi is ok, but I think it's a little to optimistic, because the routines that do the real job have to use the CPU's registers which, at least at the moment, are only 64 bit. But ok when Intel releases a 128-bit CPU. in/out in c++ std stream are added A lot of inline operators have been added too, so the compiler will do

_int128 x = 10;
int y = 20;
_int128 z = x + y;

without ambiguities.

The code is too big to fit in this answer so it's put in github with links to the files listet below

New header Int128.h

Int128x64.asm Assembler code for x64

Int128x86.cpp

Int128Str.cpp Common for x86 and x64

Int128IO.cpp Common for x86 and x64

AddIn-dll called by debugger to convert _int128/_uint128 to char*(decimal/hex)

Header for all natvis addin dll's