3 ms·
I've used nested functions more often than I'd like to admit, because dealing with insane callback-heavy APIs is made a lot easier with them.
by blattimwind 9y ago
I've used nested functions more often than I'd like to admit, because dealing with insane callback-heavy APIs is made a lot easier with them.
- s73v3r_ 9y agoI've never really thought to use nested functions for that. I guess I've never really thought of what nested functions were for.
- gmueckl 9y agoWelcome to the lambda party ;). Passing nested functions as pointers is how lambdas often work behind the scene.
- Roboprog 9y agoThose of us who had nested functions/procedures and “procedural types” in Pascal (or Algol, but that’s beyond my experience) back in the day have :-) Then K&R came, and took our nice toys away. Fortunately, the GNU Pascal compiler needed nested subroutines, so they exposed the feature in their C compiler, as well.
- pjmlp 9y agoAnd now even C# has them. :) On C++ we can fake them with lambdas.
- Gibbon1 9y agoI love using nested functions when I have to write state machine code. It's a hella a lot better than the old school way using macros to do the same thing.