Liste des Groupes | Revenir à cl c |
David Brown <david.brown@hesbynett.no> writes:And "auto", another C23. I should perhaps have had "auto constexpr x" !On 09/09/2024 20:46, Kaz Kylheku wrote:I'm not sure such a program, one that can detect either an __int128 thatOn 2024-09-09, David Brown <david.brown@hesbynett.no> wrote:On 09/09/2024 18:57, Bart wrote:How can we write a program which, in an implementation which has aOn 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.
__int128 type, outputs "yes" if it is an integer type, otherwise "no"?
isn't an integer type or an __int128 that is an integer type, is possible.
#include <stdio.h>Of course this uses digit separators, which are a new feature in C23.
>
int main() {
auto const x = 0x1'0000'0000'0000'0000;
if (x > 0xffff'ffff'ffff'ffff) {
printf("yes\n");
} else {
printf("no\n");
}
}
If an implementation doesn't have an integer type wider than 64 bits,Indeed. Conforming implementations need to give an error or warning here. But some will also then map it to a 64-bit value (I'd usually expect 0, but 0xffff'ffff or 0x7fff'ffff might also be used) and continue compilation. That gives a program with the desired behaviour. (For my own uses, I would pick flags that gave an error on such code.)
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,If an implementation had a standard integer type of 128 bits, then I expect "long long int" would be the name (unless it also had even bigger types!), but for extended integer types it could be many different things. It is very likely, however, that it would also be in <stdint.h> as int128_t.
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");
}
Les messages affichés proviennent d'usenet.