C++ Logo

std-proposals

Advanced search

Re: [std-proposals] 128-bit integers

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Sun, 11 Feb 2024 19:02:14 +0000
On Sun, 11 Feb 2024, 18:08 Thiago Macieira via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> I should also note that current GCC trunk still has no support for _BitInt
> (that I can see).
>

As Jan already said, it supports it fully.


>
> > > I don't think that's conforming. I don't think the standard gives
> > > permission for those large differences to not work.
> > Based on what Niebler says in
> > https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1522r1.pdf
> > ยง4.2, as far as I understand it, implementers can just define the
> > difference_type to not cover the whole range and ignore the problem.
>
> Isn't the difference type of the standard allocators required to be
> ptrdiff_t?
> Then it's an architectural decision, not the Standard Library's.
>

I don't see what allocators' difference_type has to do with it. iota_view
iterators don't point to memory, so they aren't restricted to differences
that fit in memory. If the value type is size_t then the difference can be
up to SIZE_MAX so you need a signed integer type that can store SIZE_MAX.
If size_t and ptrdiff_t are the same size, you can't use ptrdiff_t for that
without exposing users to UB when they use that difference.

Received on 2024-02-11 19:03:32