Sujet : Re: Top 10 most common hard skills listed on resumes...
De : bc (at) *nospam* freeuk.com (Bart)
Groupes : comp.lang.cDate : 09. Sep 2024, 17:57:37
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vbn9e1$2fqep$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : Mozilla Thunderbird
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?
>
gcc (and compilers intended to be compatible with it, like clang)
support __int128 and unsigned __int128 types, but only on 64-bit
systems, and they're not strictly integer types (for example, there are
no constants of type __int128).
Yes, I know that. IIUC clang supports bigger types, and in one
of drafts I found "bit exact integer types". At first glance it
looked that they could support bigger lengths than standard integer
types.
I had quite decent 128-bit support in my language at one time, including:
* i128 and u128 names
* 128-bit constants, including char constants up to 'ABCDEFGHIJKLMNOP'
* Ability to print 128-bit numbers
* Nearly all arithmetic, comparison and logical ops supported (only
division was limited to 128/64)
I believe this is a better spec than provided by gnuC.
However I dropped it for various reasons. Mainly because I didn't have enough use-cases for it (the only one was supporting it within the compiler!), so it was not worthwhile (being cool to have wasn't enough).
But also, in a language with otherwise only 64-bit integer types so there was no mixed-size arithmetic, now widening and narrowing comes into play again.
In C, there could be mixed 32-bit, 64-bit and 128-bit types in an expression. With the new _Bitint which allows arbitrary sizes from 1 to 63 bits as well as over 64 bits (with no apparent upper limit in the spec), it sounds like there will be lots of fun and games to be had.
Especially if it all needs to work on 32-bit targets too.