Language.C can't handle C Block syntax

Benedikt Huber benedikt.huber at gmail.com
Wed May 19 15:11:43 EDT 2010


On 19.05.2010, at 20:48, Kevin Ballard wrote:

> On May 19, 2010, at 5:03 AM, Benedikt Huber wrote:
>
>>> There is a (relatively) new extension for C called Blocks[1] that  
>>> Apple introduced in Mac OS X 10.6. Block declarations look similar  
>>> to function declarations except for using ^ in place of *.  
>>> Unfortunately Language.C doesn't understand this and ends up  
>>> triggering a parse error when processing the system header files  
>>> (even /usr/include/stdlib.h has this issue). Is there any way to  
>>> work around this issue?
>>>
>> I did not know much about this C extension, only now a little bit  
>> more after reading your reference andhttp://thirdcog.eu/pwcblocks/.  
>> I have to say that this is quite a big change to the C language  
>> (the implicit capturing of variables in closures feels non- 
>> ideomatic to me), and it seems to be Apple specific (not even in  
>> Mac OS X 10.5 without 3rd party libraries). That said, if you or  
>> someone else believes it is worth it and provides a patch, it would  
>> be ok to include the parser/AST changes in language.c.
>>
>> As a short time solution, would it be possible to use different  
>> header files, e.g. the ones from os x 10.5 ?
>
> I wish I had the time to write a patch, but I don't. And yeah,  
> blocks are a fairly significant addition, but they're extremely  
> useful. As for capturing of variables in a closure, it wouldn't be a  
> closure if it didn't capture variables ;)
> But I definitely feel it's worth it. Not only is this syntax  
> standard on Mac OS X 10.6 (and soon to be on iPhone), but the  
> extension has been submitted as an official extension of C and the  
> block syntax/runtime is already officially supported by Clang/LLVM  
> (Apple has patches available for GCC).
>
> In any case, as a short-time solution I'm just going to leave  
> Language.C alone. I was only planning on playing with it at first  
> when I discovered this issue. However, if I did have a practical  
> problem that I wanted to solve with Language.C, I'm not sure how I  
> could instruct it to apply an SDKRoot to all header files it looks up.
Ok, fair enough. Blocks are certainly a very interesting feature,  
thanks for bringing up this issue.
regards, benedikt



More information about the Language-c mailing list