Search code examples
c++integerstandards

C++ standard and 128 bit integer


What prevents C++ standard from having a 128/256 bit integer?

From other stackoverflow questions, recommendation to achieve this are Boost or compiler extension __int128 or std::bitset<>

So it is obvious that programmers are using/needing this. Why is there a reluctance in adopting it?


Solution

  • The reason is expense and lack of need. If the standard required a 128-bit integer type, every compiler would have to implement it. On hardware that doesn't support such an integer type natively, implementations would have to provide a way of generating code to emulate it. There simply aren't enough folks who need such a type to justify imposing it on every compiler.