r/cpp • • Sep 09 '26

Implementation of GCC's Nested Functions (vs. C++ Lambdas)

https://uecker.codeberg.page/2026-09-05.html
61 Upvotes

17 comments sorted by

View all comments

Show parent comment

2

u/amoskovsky Sep 10 '26

If you take an address of such a function with captures, GCC creates a trampoline function at runtime, that passes the state to the real function.

For details see https://uecker.codeberg.page/2026-08-29.html (same author as OP)