C++ Logo

liaison

Advanced search

Re: [isocpp-wg14/wg21-liaison] bigint

From: Martin Uecker <ma.uecker_at_[hidden]>
Date: Sun, 23 Aug 2026 15:26:27 +0200
Am Sonntag, dem 23.08.2026 um 14:52 +0200 schrieb Jan Schultke:
>
> > > To be clear, I'm not suggesting a big_int type for C, only the limb type that could be used internally.
> > >
> > > The C version of the feature would likely end up looking like a stdc-prefixed version of GNU MP, and I'm not really sure how much benefit there is to standardizing that, or whether WG14 has any appetite for copying and pasting GMP into the C standard.
> >
> > I think C should have a native bigint type. I suggested
> > this before (not in a paper).
> >
>
>
> Just so we're on the same page: what do you mean by "native"?
>
> Do you mean a builtin bigint type with "constructors" and "destructors" that calls malloc and free upon initialization and when it goes out of scope?
>
> Or do you just mean some bigint struct that lives in the C standard library?

Native in the builtin sense, but what I had in mind was something
that is restricted enough so that the memory can be allocated
on the stack,e.g. you could do

const _BigInt i = j * k;

but not

_BigInt i = 0;

while (...)
 i++;


But I do not have a complete design and maybe it doesn't work well
enough. But it would eliminate a lot of error cases.


Martin



 

Received on 2026-08-23 13:26:38