Deutsch   English   Français   Italiano  
<87v7z41t1m.fsf@nosuchdomain.example.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Top 10 most common hard skills listed on resumes...
Date: Mon, 09 Sep 2024 13:16:53 -0700
Organization: None to speak of
Lines: 51
Message-ID: <87v7z41t1m.fsf@nosuchdomain.example.com>
References: <vab101$3er$1@reader1.panix.com> <vbcs65$eabn$1@dont-email.me>
	<vbekut$1kd24$1@paganini.bofh.team> <vbepcb$q6p2$1@dont-email.me>
	<vbgb5q$1ruv8$1@paganini.bofh.team> <vbhbbb$1blt4$1@dont-email.me>
	<vbipp5$24kl5$1@paganini.bofh.team> <vbk0d9$1tajm$1@dont-email.me>
	<vbkpfc$27l2o$1@paganini.bofh.team> <vbl3am$228vv$1@dont-email.me>
	<vblfgb$2dkij$1@paganini.bofh.team>
	<878qw13a40.fsf@nosuchdomain.example.com>
	<vbll6l$2dpn7$2@paganini.bofh.team>
	<874j6p34df.fsf@nosuchdomain.example.com>
	<vbn79l$2g9i6$1@paganini.bofh.team> <vbn9e1$2fqep$1@dont-email.me>
	<vbnboc$2g0vc$2@dont-email.me> <20240909114553.226@kylheku.com>
	<vbngrb$2gvrs$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Mon, 09 Sep 2024 22:16:54 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5130c977fa34ae7ba7f2b29594baf74a";
	logging-data="2647568"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19+05kqj2xpLuepUPIcRO43"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:87teF+R2DvYuxIvcD3wHb2IzdSo=
	sha1:9R9SnRNhaHPW2Bxm7T18cMcN7B8=
Bytes: 3290

David Brown <david.brown@hesbynett.no> writes:
> On 09/09/2024 20:46, Kaz Kylheku wrote:
>> On 2024-09-09, David Brown <david.brown@hesbynett.no> wrote:
>>> On 09/09/2024 18:57, Bart wrote:
>>>> On 09/09/2024 17:21, Waldek Hebisch wrote:
>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>
>>>>>> C23 doesn't add any new support for 128-bit integers.
>>>>
>>>> So what does _Bitint do with a width of 128 bits?
>>>>
>>>
>>> _BitInt types are not "integer types".  Nor is gcc's __int128 type.
>> How can we write a program which, in an implementation which has a
>> __int128 type, outputs "yes" if it is an integer type, otherwise "no"?

I'm not sure such a program, one that can detect either an __int128 that
isn't an integer type or an __int128 that is an integer type, is possible.

> #include <stdio.h>
>
> int main() {
>     auto const x = 0x1'0000'0000'0000'0000;
>     if (x > 0xffff'ffff'ffff'ffff) {
>         printf("yes\n");
>     } else {
>         printf("no\n");
>     }
> }

Of course this uses digit separators, which are a new feature in C23.

If an implementation doesn't have an integer type wider than 64 bits,
then the constant 0x1'0000'0000'0000'0000 has no type, which violates a
constraint.

If an implementation does have a integer types wider than 64 bits,
there's no guarantee that it uses the name "__int128".  A future gcc
might have a 128-bit (extended) integer type and still have __int128
with its current semantics.

For gcc, this meets Kaz's specification:

#include <stdio.h>
int main(void) {
    puts("no");
}

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */