Or a flag is stored, whether the object a has been destructed.
-----Ursprüngliche Nachricht-----
Von: Zhihao Yuan via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Do 11.12.2025 23:59
Betreff: Re: [std-proposals] [PXXXXR0] Add a New Keyword `undecl`
Anlage: signature.asc
An: std-proposals@lists.isocpp.org;
CC: Zhihao Yuan <zy@miator.net>;
On Tuesday, December 9th, 2025 at 5:35 PM, Breno Guimarães via Std-Proposals <std-proposals@lists.isocpp.org> wrote:The paper says that undecl can only be called in the same brace level as the declaration. So I guess this example isn't valid.So at least the list of destructors to callduring stack unwinding isn't dynamic :)But question remains. Considervector a = f1();vector b = f2();foo(); // throw?
undecl a;undecl b;If foo() does not throw, presumablywe destruct a then b; if it throws, wethen destruct b then a? Besides,I'm not sure whether the first caseis implementable in all unwindingABIs. Please check with implementers.--Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________Em ter., 9 de dez. de 2025, 22:29, Sebastian Wittmeier via Std-Proposals <std-proposals@lists.isocpp.org> escreveu:--undeclaring a variable is the same as relocating from a variable to nothingness (or to somewhere else).
A variable, which was relocated from, may also not be used any longer afterwards.
One detail may be the difference between position in the program (source code line within the block) and program flow.
int a = -1;
for (int i = 0; i < 10; i++) {
if (i == 5)
a++; // can a be used here?
if (i == 4)
undecl a;
if (i == 5)
a++; // and here?
}
-----Ursprüngliche Nachricht-----
Von: wjf via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Mi 10.12.2025 02:23
Betreff: [std-proposals] [PXXXXR0] Add a New Keyword `undecl`
Anlage: Add_New_Keyword_undecl.pdf
An: std-proposals <std-proposals@lists.isocpp.org>;
CC: wjf <wjf@zenkee.cn>;
see attachment-- Std-Proposals mailing list Std-Proposals@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
-- Std-Proposals mailing list Std-Proposals@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals