r/programming • u/lelanthran • Sep 09 '26
Implementation of GCC's Nested Functions (vs. C++ Lambdas)
https://uecker.codeberg.page/2026-09-05.html
19
Upvotes
r/programming • u/lelanthran • Sep 09 '26
View all comments
4
u/dan00 Sep 10 '26
The C++ lambda in the example takes 'k' as reference and the GCC nested function gets a copy of 'k'.
When having two GCC nested functions, sharing the same 'frame', then 'k' is also shared, which seems like a footgun.