C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [PXXXXR0] Add a New Keyword `undecl`

From: JJ Marr <jjmarr_at_[hidden]>
Date: Tue, 9 Dec 2025 21:38:04 -0500
> seems to run counter to every coding guideline

C++ wouldn't be C++ if it didn't allow a programmer to intentionally
footgun oneself.

Typically I encounter a desire to footgun myself when I have an RAII
variable with side effects on destruction I'd like to intentionally
trigger. Specifically something that locks a resource and I need to
guarantee it'll eventually be released, so I wrap it in a guard class so I
can't forget to manually release control.

The only other alternative is std::optional which is stack-allocated and
provides a reset method, but this requires pulling in the STL. This isn't
always possible in low-level code.

On Tue, Dec 9, 2025, 8:45 p.m. codusnocturnus via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> The only motivation I can discern from the paper is to reuse a name with a
> different type/meaning, which seems to run counter to every coding
> guideline I’ve ever seen.
>
> It really seems like the existing solutions (using a different name, like
> a1 and a2, or an enclosing scope) are better in every way.
>
>
>
> Sent from Proton Mail <https://proton.me/mail/home> for iOS.
>
>
> -------- Original Message --------
> On Tuesday, 12/09/25 at 17:23 wjf via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
> see attachment
> wjf
> wjf_at_[hidden]
>
> <https://wx.mail.qq.com/home/index?t=readmail_businesscard_midpage&nocheck=true&name=wjf&icon=http%3A%2F%2Fthirdqq.qlogo.cn%2Fek_qqapp%2FAQNPOicdlIgbG9Ribmfj8EKjTG2hwBlicwibL4stQmE6UNEQ3eh3aQCoFUzN0k1xGg%2F0&mail=wjf%40zenkee.cn&code=>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-12-10 02:38:18