[PATCH] c++: v2: Add __builtin_bit_cast to implement std::bit_cast [PR93121]

Jonathan Wakely jwakely@redhat.com
Wed Nov 25 10:31:28 GMT 2020

On 25/11/20 10:23 +0100, Jakub Jelinek wrote:
>On Tue, Nov 24, 2020 at 05:31:03PM -0700, Jeff Law wrote:
>> FIrst, do we need to document the new builtin? 
>I think for builtins that are only meant for libstdc++ as underlying implementation
>of its documented in the standard APIs we have some cases where we don't
>document them and other cases where we don't.

And people report bugs when they're not documented. They might want to
know how the built-in is supposed to behave so they can implement the
equivalent in other compilers. Documenting the *intended* behaviour
also makes it clear which behaviours can be relied on, which allows us
to change the result for edge cases or out-of-contract inputs later.
If we don't describe the expected behaviour, then we can't really
blame people for relying on whatever it happens to do today.

I used to think we don't need to bother documenting them, but I've
been persuaded that it's useful to do it.

More information about the Gcc-patches mailing list