On Sep 4, 2008, at 12:14 PM, Eli Friedman wrote:
>> +    /// BlockVoidPointer - The assignment is between a closure  
>> pointer and
>> +    /// void*, we accept for now.
>
> I don't see any good reason to accept this; it'll just destroy the  
> block pointer.

void * is the canonical opaque type, and block pointers can be pushed  
into and pulled out of a void * per the usual C rules.

> Just to double-check, the comparison is roughly equivalent to memcmp  
> for block pointers?

Yes, I think so.

> The code as-is won't work correctly for cases like

> "int a(int(^b)(void)){return b  == (void*)0}".

gcc does this:

$ cat t.c
int a(int(^b)(void)) {return b  == (void*)0; }
mrs $ gcc -S t.c -fblocks -fomit-frame-pointer -O9
mrs $ cat t.s
        .text
        .align 4,0x90
.globl _a
_a:
        xorl    %eax, %eax
        cmpl    $0, 4(%esp)
        sete    %al
        ret
        .subsections_via_symbols

clang should do something similar when done.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to