This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Apple Blocks extension
- From: pinskia at gmail dot com
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Maxim Kuvyrkov <maxim at kugelworks dot com>, gcc <gcc at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Richard Henderson <rth at redhat dot com>, jason merrill <jason at redhat dot com>, Mark Mitchell <mark at codesourcery dot com>, Nathan Sidwell <nathan at codesourcery dot com>, Mike Stump <mikestump at comcast dot net>, Stan Shebs <stan at codesourcery dot com>
- Date: Sun, 3 Nov 2013 21:18:45 -0800
- Subject: Re: [RFC] Apple Blocks extension
- Authentication-results: sourceware.org; auth=none
- References: <0F6B78F3-8442-4978-A34D-0BB54DC75B7A at kugelworks dot com> <B433F978-7798-4B6D-ABD5-24B4D2D3B916 at gmail dot com> <CAKOQZ8xApp645J-E0ktY0wgBgJVCa6eKrp2MwBqFx5XH1Bf28g at mail dot gmail dot com>
> On Nov 3, 2013, at 9:10 PM, Ian Lance Taylor <iant@google.com> wrote:
>
>> On Sun, Nov 3, 2013 at 8:49 PM, <pinskia@gmail.com> wrote:
>>
>>
>>> On Nov 3, 2013, at 8:28 PM, Maxim Kuvyrkov <maxim@kugelworks.com> wrote:
>>>
>>> Hi,
>>>
>>> I am considering a project to add Apple's blocks [*] extension to GCC. I am looking at adding blocks support to C, C++ and Obj-C/C++ front-ends.
>>
>> What benefits does blocks have over nested functions in C and over lambas in C++? I think it is wrong to add another extension if only to be compatible with clang. I also think the blocks extension are less useful than nested functions and lambas. The question really should be why support something which has no advantage to them to what is already existing. I think it was wrong for apple to add them in the first place.
>
> Clang's blocks are more powerful than GCC's nested functions, because
> blocks may be placed on the heap, and therefore returned from a
> function.
Actually I think it is less powerful since it is a copy rather than a reference. Then again lambas can be do both.
>
> Ian