News for hackers. Stuff that matters.
Re:List Processing in C by danieldk on Tuesday December 21, 2010 @04:43AM (#2027406)
I guess it's just not very well known that C has functions which can also be passed as values.

Perhaps more interesting and newsworthy in this context are Apple's blocks, which are closures:

http://thirdcog.eu/pwcblocks/

Re:List Processing in C by maw on Tuesday December 21, 2010 @11:13AM (#2028204)
I thought function pointers were a well known part of C. How long can you program C before needing to call qsort or similar? Or before you encounter (or create) your own method table?

GLib offers closures in C; I've never used them, though, and they don't look very convenient.

Re:List Processing in C by JoachimSchipper on Tuesday December 21, 2010 @05:01AM (#2027421)
That's not standard C, though.
Re:List Processing in C by danieldk on Tuesday December 21, 2010 @05:30AM (#2027457)
That's why it says 'Apple's blocks' and not 'C99 blocks' or 'C1X blocks'. Though, it is part of mainline clang, so it is not restricted to OS X in any way.
Re:List Processing in C by pavlov on Tuesday December 21, 2010 @06:30AM (#2027524)
Of course blocks also requires runtime support. The compiler is useless without a matching runtime library. Is there a production-quality "C-with-blocks" runtime available for other platforms than OS X?
Re:List Processing in C by memoryhole on Tuesday December 21, 2010 @07:00AM (#2027555)
I'm not sure if it is production quality, but I have successfully used this to get C-with-blocks in Archlinux. http://compiler-rt.llvm.org/index.html