Date: Mon, 21 Sep 2026 09:18:33 +0100
On Mon, 21 Sept 2026, 08:55 Jan Schultke via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
>
>
> On Mon, 21 Sept 2026 at 09:45, Liam Graham via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> We have reinterpret_cast, const_cast, dynamic_cast, static_cast.
>>
>> What does the CPU do? Nothing. It doesn't care
>>
>
> It does care. If you have a pointer to a base class subobject and cast
> that to a derived type, i.e. cast<Derived*>(&my_base_object):
>
> - reinterpret_cast might downcast "too far" because it casts to the
> most derived object for polymorphic classes, or do something else
> nonsensical if you're not dealing with polymorphic classes
> - static_cast will downcast properly, but is unchecked and results in
> UB if you don't actually have a surrounding derived object
> - dynamic_cast will perform a runtime check for whether the cast is
> valid and give you a null pointer if it's not
> - std::bit_cast will reinterpret the pointer bits unchanged, whatever
> that does
>
>
And a C cast will ignore access control to allow casting to private bases.
My feedback on the proposal is simple: No.
If you want to use C casts everywhere in your own code, you can already do
that. Don't expect everybody else to join in.
std-proposals_at_[hidden]> wrote:
>
>
> On Mon, 21 Sept 2026 at 09:45, Liam Graham via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> We have reinterpret_cast, const_cast, dynamic_cast, static_cast.
>>
>> What does the CPU do? Nothing. It doesn't care
>>
>
> It does care. If you have a pointer to a base class subobject and cast
> that to a derived type, i.e. cast<Derived*>(&my_base_object):
>
> - reinterpret_cast might downcast "too far" because it casts to the
> most derived object for polymorphic classes, or do something else
> nonsensical if you're not dealing with polymorphic classes
> - static_cast will downcast properly, but is unchecked and results in
> UB if you don't actually have a surrounding derived object
> - dynamic_cast will perform a runtime check for whether the cast is
> valid and give you a null pointer if it's not
> - std::bit_cast will reinterpret the pointer bits unchanged, whatever
> that does
>
>
And a C cast will ignore access control to allow casting to private bases.
My feedback on the proposal is simple: No.
If you want to use C casts everywhere in your own code, you can already do
that. Don't expect everybody else to join in.
Received on 2026-09-21 08:18:56
