News for hackers. Stuff that matters.
Re:A Defer Mechanism for C by ufo on Monday December 14, 2020 @10:05AM (#25418353)
I got the impression that the proposal still has some aspects of the design that are open for discussion, including whether it should be static or dynamic, and whether it should capture the variables by value or by reference. (These are discussed in pages 13-16)
Re:A Defer Mechanism for C by rseacord on Monday December 14, 2020 @12:14PM (#25420072)
Based on feedback from the committee, I think it's very unlikely a dynamic approach will be used. The static only affects the for loop in terms of whether the deferred statements are run once or for each iteration of the loop, and the only real world use of this I've found so far involves allocating and deallocating resources within each loop iteration which would be supported by the static approach.
Re:A Defer Mechanism for C by scott_s on Monday December 14, 2020 @10:50AM (#25418880)
Yes, see the discussion in the proposal on page 13, under the heading "Should defer statements be static or dynamic?": http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2542.pdf