Date: Sun, 30 Mar 2025 16:12:57 +0100
On Sun, 30 Mar 2025, 15:16 Frederick Virchanza Gotham via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
>
>
> On Sunday, March 30, 2025, Thiago Macieira wrote:
>
>> On Saturday, 29 March 2025 17:04:46 Eastern Daylight Time Jonathan Wakely
>> wrote:
>
> > On what platform in existence today does a type that's at least 32 bits
>> > promote?
>>
>> None. It would need to be a platform with an int probably of 64 bits,
>> which
>> doesn't exist.
>>
>
>
> I'm currently writing a fully-portable (C++14) implementation of MD5
> constexpr, in order to make a single-header-only library to generate UUID's
> at compile time. I'm testing it on 27 cross-compilers, both big endian and
> little endian, as well as on my trusty Texas Instruments microcontroller
> that has a 16-Bit char and a 16-Bit int.
>
> CHAR_BIT == 16 && 1==sizeof(short)==sizeof(int)
>
> Also I'm accommodating one's complement and sign magnitude (even though
> C++20 has outlawed them).
>
> Another thing I'm accommodating is:
>
> CHAR_BIT==64 && sizeof(short)==sizeof(long long)
>
> So anyway my code looks a little ridiculous in places as I'm
> super-paranoid about stuff such as a 32-Bit unsigned int promoting to a
> 64-Bit signed int.
>
As discussed, there are no platforms in existence where that can happen,
and that's unlikely to change.
> I wrote an article 15 years ago about integer promotion . . . if you
> scroll down to the very bottom you'll see what happens if you invert the
> bits of an unsigned 16-Bit integer on a one's complement machine:
>
> http://www.virjacode.com/tutorials/c_int_promotion/index.html
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
std-proposals_at_[hidden]> wrote:
>
>
> On Sunday, March 30, 2025, Thiago Macieira wrote:
>
>> On Saturday, 29 March 2025 17:04:46 Eastern Daylight Time Jonathan Wakely
>> wrote:
>
> > On what platform in existence today does a type that's at least 32 bits
>> > promote?
>>
>> None. It would need to be a platform with an int probably of 64 bits,
>> which
>> doesn't exist.
>>
>
>
> I'm currently writing a fully-portable (C++14) implementation of MD5
> constexpr, in order to make a single-header-only library to generate UUID's
> at compile time. I'm testing it on 27 cross-compilers, both big endian and
> little endian, as well as on my trusty Texas Instruments microcontroller
> that has a 16-Bit char and a 16-Bit int.
>
> CHAR_BIT == 16 && 1==sizeof(short)==sizeof(int)
>
> Also I'm accommodating one's complement and sign magnitude (even though
> C++20 has outlawed them).
>
> Another thing I'm accommodating is:
>
> CHAR_BIT==64 && sizeof(short)==sizeof(long long)
>
> So anyway my code looks a little ridiculous in places as I'm
> super-paranoid about stuff such as a 32-Bit unsigned int promoting to a
> 64-Bit signed int.
>
As discussed, there are no platforms in existence where that can happen,
and that's unlikely to change.
> I wrote an article 15 years ago about integer promotion . . . if you
> scroll down to the very bottom you'll see what happens if you invert the
> bits of an unsigned 16-Bit integer on a one's complement machine:
>
> http://www.virjacode.com/tutorials/c_int_promotion/index.html
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2025-03-30 15:13:14