[cfe-dev] [PATCH] add unconditional support for @encode block descriptor string

Fariborz Jahanian fjahanian at apple.com
Fri Feb 19 17:21:21 PST 2010


On Feb 19, 2010, at 4:12 PM, David Chisnall wrote:

> On 19 Feb 2010, at 19:31, Fariborz Jahanian wrote:
>
>> We can't change the encoding. Encoding for block is '@' for block  
>> and '?' for function type. Similar to function pointer type; except  
>> that
>> '^?' is used.
>
>
> 1) ? actually signifies 'unknown type', not 'function type'
Granted you may not be looking at our Darwin source tree. But here it  
is:

else if (code == FUNCTION_TYPE) /* '?' */
     obstack_1grow (&util_obstack, '?');


>
> 2) This is completely irrelevant to what I said.  I was talking  
> about the return from doing something like:
>

Uncalled for. You need to be more clear so my comments become more  
'relevant'.

> typedef void(^foo)(id, void*);   @encode(foo);
>
> This currently returns "@?" if foo is any block type, rather than  
> the type encoding that we are storing with the block.  To get the  
> block type encoding, we need to look up the type of a template block  
> at run time, which prevents some optimisations when you test that  
> two type encodings match, because neither is known at compile time  
> (even though one actually is).

Fact of the matter is that we cannot change block's encoding at this  
time.
If you are using the same api to store encoding in block that @encode  
uses, you will get "@?". This is not very helpful. You need to write  
your
own encoding logic for block's detailed encoding to store in block's  
descriptor.

- Fariborz

>
>
> David
>
> -- Sent from my PDP-11
>




More information about the cfe-dev mailing list