Re:A Defer Mechanism for C
by cycloptic on Monday December 14, 2020 @01:20PM
(#25421093)
>It's essentially exceptions for C. This is frankly horrifying and I can't believe the C standards committee is entertaining this.
I can because C already includes setjmp/longjmp as an exception mechanism that gets used in plenty of real code. The problem here is that those don't unwind the stack so they would break and cause memory leaks when using defer statements.
Re:A Defer Mechanism for C
by jbboehr on Tuesday December 15, 2020 @03:04PM
(#25434452)
If you're already using setjmp/longjmp I would suspect you are also already using an arena or avoiding heap allocations, so I don't know if it would specifically be a problem for memory leaks with defer.
I can because C already includes setjmp/longjmp as an exception mechanism that gets used in plenty of real code. The problem here is that those don't unwind the stack so they would break and cause memory leaks when using defer statements.