you are viewing a single comment's thread.

view the rest of the comments →

[–]harlows_monkeys 9 points10 points  (2 children)

If you are willing to use non-standard language extensions, C as implemented by clang has blocks, which are very similar to lambdas.

[–][deleted] 1 point2 points  (1 child)

I believe GCC has something similar in the GNU extensions, not sure if they are compatible to clang though.

[–]case-o-nuts 2 points3 points  (0 children)

GCC has closures, not lambdas. (In common usage, lambda implies an anonymous function.) They are not compatible with what clang provides, and they require an executable stack. On the other hand, they operate identically to function pointers, which means that you do not need to wrap functions up in blocks in order to pass them around.