News for hackers. Stuff that matters.
Re:Lambdas in C by huhtenberg on Friday July 01, 2011 @06:14PM (#2720353)
Anonymous functions are very handy, and I think they should really be taken a step further. There's really no reason why it shouldn't be possible to pass an actual function body where a function pointer is required:

  int v[...];

  qsort( v, ..., (a, b) { return *(int*)a - *(int*)b } );
Such usage would also have an added benefit of letting the compiler do the type inference for a, b and the return value and not needing to explicitly specify them in qsort() call.

There are no comments on this comment yet.