[cfe-commits] [PATCH] Treat "int (^x)()" as "int (^x)(void)" instead of a K&R style prototype

Chris Lattner clattner at apple.com
Sun May 31 12:38:45 PDT 2009


On May 31, 2009, at 12:28 PM, Eli Friedman wrote:

> On Sun, May 31, 2009 at 11:31 AM, Chris Lattner<clattner at apple.com>  
> wrote:
>>
>> On May 31, 2009, at 8:58 AM, Fariborz Jahanian wrote:
>>
>>> For blocks in gcc we followed the rules for function pointers in the
>>> host language wrt to block pointers.
>>> This change will make it more c++-ish and may break some of our
>>> internal projects.
>>> But it is a new feature and it is good to tighten up the rules. So  
>>> it
>>> is OK.
>>
>> While I sympathize with wanting to tighten up new features, this  
>> makes block
>> pointers work differently than function pointers.  Is it really  
>> worth it?
>>  What problem does this solve?
>
> This was inspired from the following comment (and corresponding code):

I think that that comment dates from when we were *trying* to be more  
strict about block types, but something backfired (I don't remember  
what it was) and we had to revert to following the base language.

> Also, it's impossible to actually define a block without a prototype
> that takes any arguments, so that removes a lot of the motivation for
> K&R style declarators.

I agree!  A lot of it depends on whether int(^)() is compatible with  
int(^)(int) etc.

-Chris



More information about the cfe-commits mailing list