2016 update: Apple-style apple apples with closure were again presented to the Working Group at a meeting in London in 2016 in a new application document that is trying to address some of the shortcomings of the previous attempt, to legitimize terminology and explanations, and delve into more details about both closures and lambdas can be made "C-like".
Since the reception was cautiously positive (7-0-9 Yes / No / Abstained), it is very likely that something similar to this will soon pass into the language.
The short answer is that C does not include lambda functions because no one has yet made an acceptable proposal for the ISO C working group to include lambda functions.
You can take a look at the list of some of the proposals discussed by the working group here: http://www.open-std.org/jtc1/sc22/wg14/www/documents
The only suggestion for lambdas of any type that I can find on this list is the Apple blocks (as shown in Yu Hao's answer) in document N1451 . This proposal is discussed further in N1483 , which compares it with C ++ lambdas and N1493 and N1542 , which are the minutes of the meetings at which these documents were presented.
There were several reasons why proposal N1451 could not be accepted, given in N1542:
- initially the committee had difficulty understanding the proposal
- it uses incorrect quotes and terminology that are contrary to the existing C standard
- he seems vague and incomplete
- Apple tried to patent this feature (it is not clear whether this is an obstacle to standardization or not, but I would suggest so)
- A completely new feature with completely new semantics proposed in 2010 had an absolutely zero chance of being ready for success for 2011 and would delay the release of C11
- Blocks as presented are not compatible with C ++ 11 lambdas
It seems they are not convinced that it is currently demonstrating sufficient utility. C standardization seems to be trying to be very conservative, and with only one major compiler implementing this function, it is likely that they will want to wait and see how it competes with C ++ lambdas, and someone else picks it up. This is not really a "C" function, not a "Clang" function, until several compilers offer it.
All that was said, the votes of the committee members seemed to have softened slightly in favor of this function (6-5-4 Yes / No / Abstained), but not enough to take the necessary consensus to include it.
As far as I can tell, the other big one, C ++ 11 lambdas, was not suggested for inclusion in C by anyone; and if you do not ask what you will not receive.
Any suggestion for lambdas in C will add a whole host of new rules about lifetimes and locations of variables, as well as copying and distribution, etc. For many people, this potentially starts to look very non-C-like, with values being moved behind the programmer, or sudden unexpected changes in their life expectancy - avoiding these kinds of things, this is half the reason people prefer to write C today. Thus, there should also be a proposal that actually corresponds to the concept of “philosophy” before one can take it seriously. I am sure that this can be done, but both big sentences have so far been developed for languages with a completely different “philosophy”, where such things are less obstructing and do not necessarily reflect the purpose and character of C as they currently stand.