Hacker News new | ask | show | jobs
by AndriyKunitsyn 778 days ago
Curiously, C actually has bignums. Now. In C23, they added a _BitInt(N) type (e.g., "_BitInt(1024)" for a 128-byte type).

The compiler support for that is limited, though. To let N be >128 in Clang, -fexperimental-max-bitint-width=N flag can be provided. If N>128 and _BitInt(N) is divided by something, the compiler will just crash, but +, -, * all work as expected.

2 comments

Neat. Maybe in ten years I'll actually be able rely on it existing in code I write!
With all the things the C standard lacks... I would not have expected this to be included!