Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: _BitInt(N)
Date: Mon, 15 Dec 2025 08:21:44 -0800
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <86tsxru353.fsf@linuxsc.com>
References: <10dajlh$ko3c$1@dont-email.me> <10fv2dm$3can9$1@paganini.bofh.team> <10fv40v$1f7a2$1@dont-email.me> <87ms4c4bom.fsf@example.invalid> <10g08vm$1us25$1@dont-email.me> <10g1et7$2bmus$1@dont-email.me> <10g1j7h$2deh9$1@dont-email.me> <10g1qq9$2f8lb$4@dont-email.me> <10g28gm$2mf9s$1@dont-email.me> <10g2f2d$2oufq$1@dont-email.me> <10g2m3v$2s5sa$1@dont-email.me> <10gfkqd$19n2d$1@paganini.bofh.team> <10gftqi$3qhkg$1@dont-email.me> <87sedw9wjh.fsf@example.invalid> <10gga8k$3v646$1@dont-email.me> <10gghbg$3htol$4@dont-email.me> <10gheka$bgvr$1@dont-email.me> <10ghu7d$3htol$5@dont-email.me> <10gi0ep$i4fi$1@dont-email.me> <10gjqts$17nkj$1@dont-email.me> <875xaq9m51.fsf@example.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Mon, 15 Dec 2025 16:21:45 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="3b66f75cc16331490dd39d06d7ef9603"; logging-data="2116619"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19v+Qb4Hbqvu8Xog5hbYltFkcbso+2khk0="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:8mdsm3jqp63jeutvNDx2BXXZYP8= sha1:gMJabxx9TFN+n02ZQ0QDliEI3JU=
Xref: csiph.com comp.lang.c:395818
Keith Thompson writes:
> David Brown writes:
> [...]
>
>> (I am not entirely sure, but I think it is standards-conforming for
>> an implementation to haev BITINT_MAXWIDTH set to 64 and support all
>> _BitInts up size 64, and then also support _BitInts of multiples of
>> 64 thereafter. Use of _BitInt greater than BITINT_MAXWIDTH is UB
>> in the standard - so an implementation can choose to give that a
>> defined behaviour for specific sizes.)
>
> [...]
>
> No, _BitInt(N) where N > BITINT_MAXWIDTH is a constraint violation.
>
> N3220 6.7.3.1p2 ("Constraints") :
>
> The parenthesized constant expression that follows the _BitInt
> keyword shall be an integer constant expression N that specifies
> the width (6.2.6.2) of the type. The value of N for unsigned
> _BitInt shall be greater than or equal to 1. The value of N
> for _BitInt shall be greater than or equal to 2. The value of
> N shall be less than or equal to the value of BITINT_MAXWIDTH
> (see 5.2.5.3.2).
>
> As I mentioned before, there's a proposal for C2y to allow
> signed _BitInt(1).
Yay! Sanity prevails.