C++ Logo

std-proposals

Advanced search

Re: [std-proposals] D4037R0 Allowing signed char and unsigned char in random number generation

From: Jan Schultke <janschultke_at_[hidden]>
Date: Thu, 26 Feb 2026 18:27:25 +0100
> Would it make sense to say that it's implementation-defined whether
> extended integer types are supported (by each template in [rand], that
> is), rather jumping straight into UB? Aim is to reduce the surface of
> gratuitous UB (UB that may just work™ on certain implementations so why
> not make it official.)
>

Dunno, maybe. To be fair, this isn't runtime UB but IFNDR. The conundrum is
that while libstdc++ supports character types and types such as __int128,
which historically wasn't considered an extended integer type. If you say
that there are optionally supported types, the wording has to make sense
for them, and I fear that the wording wouldn't make any sense for a type
like __int128 if it isn't even considered an integer.

IFNDR is arguably what we want given the existing practice.

Received on 2026-02-26 17:27:39