Sujet : Re: Top 10 most common hard skills listed on resumes...
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 09. Sep 2024, 21:16:53
Autres entêtes
Organisation : None to speak of
Message-ID : <87v7z41t1m.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Gnus/5.13 (Gnus v5.13)
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.comvoid Void(void) { Void(); } /* The recursive call of the void */