Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is (double (^)(int))foofoo

There is an example on cdecl that goes (double (^)(int))foofoo means cast foofoo into block (int) returning double.

What does it mean to cast foofoo into a "block" of int? What does the symbol ^ exactly mean in this context. Usually it is bitwise XOR.

like image 401
bobobobo Avatar asked Aug 23 '10 21:08

bobobobo


1 Answers

It's a GCC extension made by Apple, and implemented also in Clang. Blocks are small unnamed functions and that syntax is the type of a block. See Block Language Spec.

like image 130
Johannes Schaub - litb Avatar answered Oct 29 '22 16:10

Johannes Schaub - litb