logoalt Hacker News

jcranmeryesterday at 2:33 PM1 replyview on HN

A C++ lambda that doesn't close over anything can be converted to a function pointer: https://eel.is/c++draft/expr.prim.lambda#closure-12 This feature does turn out to be useful if you need to pun a C++ interface into a function pointer for a C ABI function.


Replies

kccqzyyesterday at 6:33 PM

I know that but it’s not relevant to the discussion. A nested function in C (or rather GCC-flavored C) that doesn’t close over anything doesn’t need a trampoline anyways.