C++ Logo

std-proposals

Advanced search

Re: [std-proposals] PROPOSAL: Standardise one cast — a cast’s a cast

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Mon, 21 Sep 2026 11:09:45 +0200
pon., 21 wrz 2026 o 10:28 Simon Schröder via Std-Proposals
<std-proposals_at_[hidden]> napisał(a):
>
> C-style casts have never been removed from the standard. You are still allowed to use them. There is no change required.
>
> I vaguely remember a talk from Herb Sutter a few years ago when he first showed his cpp2 syntax. There, he proposed 'as' as a keyword to do different casts. The context would make it clear which kind of cast is required, but you could only do a single one of the casts at once (so, only const_cast or static_cast, but not both at the same time). The rules for this cast would be a little stricter than C-style casts. I could certainly get behind this. But I'm totally against C-style casts (but, feel free to use them yourself).
>

`as` proposal was interesting (+ match syntax). It could fix a couple
things at once.
I wonder what the status is now of it? Do Herb plan to continue it?

> On Mon, Sep 21, 2026 at 9:45 AM 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
>>
>> Ergonomics again. Writing them out in that weird
>>
>> CATEGORY_CAST<T>(U) syntax is very unorthodox to write out, it looks like a template with the <N> thing when it’s not.
>>
>> I propose reintroducing C casts as the predominant form of casting.
>>
>> (T)(U) that's unambiguous
>> (const T)(non const U)
>> (CObject)(CObChild)
>>
>>
>>
>> Sent from Outlook for iOS
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-09-21 09:10:00