Tutorial :C++0x Lambda Support in GCC for the iPhone



Question:

Can anyone tell me if C++ lambda expressions will be supported by GCC for the iPhone in the future?

Obviously Apple have their custom 'block' support so I wondered what this may eventually mean in terms of portable C++0x code to the iPhone platform?


Solution:1

Unless all Apple engineers have suddenly and simultaneously entered a vegetative state requiring adult diapers and a 24-hour nurse, yes, it will be supported in the future.

It is common for compiler vendors to jump the gun and add pending features in their own special way. That has never stopped them from eventually adopting emerging standards. In the case of code blocks, the syntax is orthogonal to C++1x lambdas, probably intentionally so, such that there will be no conflict when they adopt the standard.

(Of course, I could be wrong. :-)


Solution:2

I agree that Apple blocks and C++-0x lambdas are syntactically different enough that there won't be a problem for Apple to implement lambdas. The potentially sticky part might be parsing the lambda capture and objective-C dispatch syntax together in Objective-C++0X ;-). I think this was at least thought of in GCC when lambdas went in but I don't think this combo has been hit very hard to work out problems. Time will tell.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »