4 ms·
This [1] explains how to create them using nested functions. Near the end is a quick blurb about the implementation which is probably why c++ doesn’t do it that
by swiley 7y ago
This [1] explains how to create them using nested functions. Near the end is a quick blurb about the implementation which is probably why c++ doesn’t do it that way.
[1] https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html
- saagarjha 7y agoOh no, nested functions are a terrible, insecure hack that are far too verbose to be ergonomic closures :(
- swiley 7y agoOf course, that’s why I said it’s good for hacking. Although I’m not sure I agree about the “ergonomic” thing.
- amiga_500 7y agoWouldn't you just use a lambda nowadays?
- im3w1l 7y agoNot in C you wouldn't.