from Hacker News

Anonymous functions in C

by C-- on 6/21/14, 6:16 PM with 50 comments

  • by mtdewcmu on 6/21/14, 9:42 PM

    This is basically a way of obfuscating your C code. If you want to write obfuscated code, C++ has extensive support for this. I think it's actually a strength of C to not have many features. It ultimately makes code more readable and reliable.
  • by overgard on 6/21/14, 9:54 PM

    That's neat, but without closures I don't really see how you could do much with it outside of toy examples. Going off the examples -- how often do you write something like a foreach or a map or reduce that doesn't reference its enclosing scope?
  • by yason on 6/21/14, 10:34 PM

    Anonymous (or inner) functions aren't really valuable per se but syntactic sugar for writing the code into a static function somewhere in the same file: closures give anonymous (or inner) functions the power which is what makes them useful.
  • by misframer on 6/22/14, 1:01 AM

  • by malkia on 6/22/14, 3:46 AM

    Wondering how a debugger would react to this code?