Liste des Groupes | Revenir à cl c |
On 09/09/2024 22:16, Keith Thompson wrote:[...]
I felt free to use C23 because we were already talking about the
support, or lack thereof, of 128-bit integers in C23, and also
_BitInt. And on a platform that supported 128-bit integer types,
"auto" would pick a 128-bit type here, while other platforms would
pick a 64-bit type.
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.
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.)
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.
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.
Do you know of any implementations that do have 128-bit integer types?
In particular, any that have a compiler on godbolt.org?
Les messages affichés proviennent d'usenet.