@yrlf @shafik @regehr @thephd I would too like _Bit_cast even if it is not constexpr for C26. For constexpr, the biggest issue is padding bits and for 80bit fp (and double doubles) defined values.
Conversation
Notices
-
Embed this notice
pinskia (pinskia@hachyderm.io)'s status on Friday, 20-Dec-2024 16:52:03 JST pinskia
-
Embed this notice
_L4NyrlfL1I0 (yrlf@graz.social)'s status on Friday, 20-Dec-2024 16:52:05 JST _L4NyrlfL1I0
@shafik @regehr I think the main reason it is like this is that there is no easy and concise way to do type punning like this in C. In C++ we have std::bit_cast now, which works (as long as your floats are IEEE754), but in C the alternative is uglier (either unions or manual memcpy, though I don't know if the union trick is even legal).
@thephd can we please have _Bit_cast() in C26/C29? This would solve so many things.
-
Embed this notice